From 5539d13170e51e1877bf6e070e22e197656e48d9 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 23 Mar 2022 11:47:15 +0300 Subject: sidebar: factor out the "entry" include --- _includes/common/sidebar.html | 78 ++++++++++++++++++++----------------- _includes/common/sidebar_entry.html | 4 ++ 2 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 _includes/common/sidebar_entry.html (limited to '_includes') diff --git a/_includes/common/sidebar.html b/_includes/common/sidebar.html index 43b25dd..4eeeac2 100644 --- a/_includes/common/sidebar.html +++ b/_includes/common/sidebar.html @@ -1,41 +1,47 @@ {% unless site.settings.sidebar.hide or page.sidebar.hide %}
-
-

About

- {% 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 }} -
-
- {% if site.posts.size > 0 %} -
-

Latest posts

-
- {% for post in site.posts limit: 5 %} - -  {{ post.date | date: '%-d %b %Y' }} -  {{ post.title }} - - {% endfor %} -
-
+ +{% 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 common/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 common/sidebar_entry.html header='Latest posts' content=latest_posts_content %} +{% endif %} +
{% endunless %} diff --git a/_includes/common/sidebar_entry.html b/_includes/common/sidebar_entry.html new file mode 100644 index 0000000..761119d --- /dev/null +++ b/_includes/common/sidebar_entry.html @@ -0,0 +1,4 @@ +
+

{{ include.header }}

+ {{ include.content }} +
-- cgit v1.2.3