From d5357e0da98f36da32fb8c817882d6768f8be689 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 24 Mar 2022 11:05:38 +0300 Subject: move sidebar entries to separate includes --- _includes/jekyll-theme/sidebar.html | 45 ++---------------------- _includes/jekyll-theme/sidebar/about.html | 25 +++++++++++++ _includes/jekyll-theme/sidebar/latest-posts.html | 16 +++++++++ 3 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 _includes/jekyll-theme/sidebar/about.html create mode 100644 _includes/jekyll-theme/sidebar/latest-posts.html diff --git a/_includes/jekyll-theme/sidebar.html b/_includes/jekyll-theme/sidebar.html index f453f8b..0879248 100644 --- a/_includes/jekyll-theme/sidebar.html +++ b/_includes/jekyll-theme/sidebar.html @@ -1,47 +1,6 @@ {% unless site.settings.sidebar.hide or page.sidebar.hide %}
- -{% capture about_content %} -{% assign project_desc = site.settings.project.description %} -{% unless project_desc %} - {% if site.github %} - {% assign project_desc = site.github.project_tagline %} - {% endif %} -{% endunless %} -{% if project_desc %} - {% capture project_desc %}{{ project_desc }}. {% endcapture %} -{% endif %} -{% capture project_desc %}{{ project_desc }}Feel free to contribute or contact me.{% endcapture %} -

{{ project_desc }}

-
- {% 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 header='About' content=about_content %} - -{% if site.posts.size > 0 %} - -{% capture latest_posts_content %} -
- {% for post in site.posts limit: 5 %} - -  {{ post.date | date: '%-d %b %Y' }} -  {{ post.title }} - - {% endfor %} -
-{% endcapture %} - -{% include jekyll-theme/sidebar/entry.html header='Latest posts' content=latest_posts_content %} -{% endif %} - + {% include jekyll-theme/sidebar/about.html %} + {% include jekyll-theme/sidebar/latest-posts.html %}
{% endunless %} diff --git a/_includes/jekyll-theme/sidebar/about.html b/_includes/jekyll-theme/sidebar/about.html new file mode 100644 index 0000000..9806b87 --- /dev/null +++ b/_includes/jekyll-theme/sidebar/about.html @@ -0,0 +1,25 @@ +{% capture about_content %} +{% assign project_desc = site.settings.project.description %} +{% unless project_desc %} + {% if site.github %} + {% assign project_desc = site.github.project_tagline %} + {% endif %} +{% endunless %} +{% if project_desc %} + {% capture project_desc %}{{ project_desc }}. {% endcapture %} +{% endif %} +{% capture project_desc %}{{ project_desc }}Feel free to contribute or contact me.{% endcapture %} +

{{ project_desc }}

+
+ {% 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 header='About' content=about_content %} diff --git a/_includes/jekyll-theme/sidebar/latest-posts.html b/_includes/jekyll-theme/sidebar/latest-posts.html new file mode 100644 index 0000000..513c2a6 --- /dev/null +++ b/_includes/jekyll-theme/sidebar/latest-posts.html @@ -0,0 +1,16 @@ +{% if site.posts.size > 0 %} + +{% capture latest_posts_content %} +
+ {% for post in site.posts limit: 5 %} + +  {{ post.date | date: '%-d %b %Y' }} +  {{ post.title }} + + {% endfor %} +
+{% endcapture %} + +{% include jekyll-theme/sidebar/entry.html header='Latest posts' content=latest_posts_content %} +{% endif %} + -- cgit v1.2.3