From 713aa48f60d337743917fd21347594561eef377b Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 6 Nov 2022 23:49:15 +0100 Subject: sidebar: split "about" and "links" into different includes --- README.md | 6 +++--- _includes/jekyll-theme/sidebar.html | 1 + _includes/jekyll-theme/sidebar/about.html | 14 -------------- _includes/jekyll-theme/sidebar/links.html | 21 +++++++++++++++++++++ 4 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 _includes/jekyll-theme/sidebar/links.html diff --git a/README.md b/README.md index b3e2bab..c4fa63f 100644 --- a/README.md +++ b/README.md @@ -114,9 +114,9 @@ Hide the link by setting `site.settings.navbar.github` to `false`. Hide the sidebar by setting either `site.settings.sidebar.hide` or `page.sidebar.hide` to `true`. -The sidebar includes two entries by default: "About" and "Latest posts". -Hide them individually by setting `sidebar.{about,latest_posts}.hide` to `true` -(under either `site.settings` or `page`). +The sidebar includes 3 entries by default: "latest posts", "about" and "links". +Hide them individually by setting `sidebar.{latest_posts,about,links}.hide` to +`true` (under either `site.settings` or `page`). Add content to the sidebar by putting it in your _includes/custom-sidebar.html. diff --git a/_includes/jekyll-theme/sidebar.html b/_includes/jekyll-theme/sidebar.html index 2ffe91b..5bcda66 100644 --- a/_includes/jekyll-theme/sidebar.html +++ b/_includes/jekyll-theme/sidebar.html @@ -3,5 +3,6 @@ {% include jekyll-theme/sidebar/latest-posts.html %} {% include custom-sidebar.html %} {% include jekyll-theme/sidebar/about.html %} + {% include jekyll-theme/sidebar/links.html %} {% endunless %} diff --git a/_includes/jekyll-theme/sidebar/about.html b/_includes/jekyll-theme/sidebar/about.html index 9ea927c..4d3787e 100644 --- a/_includes/jekyll-theme/sidebar/about.html +++ b/_includes/jekyll-theme/sidebar/about.html @@ -20,20 +20,6 @@

{{ project_desc }}

- -
-
-

links

-
- {% if site.github %} - {% assign github_link = site.settings.navbar.github.link | default: 'GitHub' %} - {% assign github_icon = site.settings.navbar.github.icon | default: 'globe' %} - {% capture github_icon %} {% endcapture %} - {{ github_icon }}{{ github_link }} - {% endif %} - {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %} -  {{ author_email }} -
{% endcapture %} {% include jekyll-theme/sidebar/entry.html content=about_content %} diff --git a/_includes/jekyll-theme/sidebar/links.html b/_includes/jekyll-theme/sidebar/links.html new file mode 100644 index 0000000..1b56467 --- /dev/null +++ b/_includes/jekyll-theme/sidebar/links.html @@ -0,0 +1,21 @@ +{% unless site.settings.sidebar.links.hide or page.sidebar.links.hide %} + +{% capture links_content %} +
+
+

links

+
+ {% if site.github %} + {% assign github_link = site.settings.navbar.github.link | default: 'GitHub' %} + {% assign github_icon = site.settings.navbar.github.icon | default: 'globe' %} + {% capture github_icon %} {% endcapture %} + {{ github_icon }}{{ github_link }} + {% endif %} + {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %} +  {{ author_email }} +
+{% endcapture %} + +{% include jekyll-theme/sidebar/entry.html content=links_content %} + +{% endunless %} -- cgit v1.2.3