aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-03-23 11:47:15 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2022-03-23 11:47:15 +0300
commit5539d13170e51e1877bf6e070e22e197656e48d9 (patch)
treed059afb04b0ca9702af4c546590809b9acd470a1
parentshell: refactor CSS a bit (diff)
downloadjekyll-theme-5539d13170e51e1877bf6e070e22e197656e48d9.tar.gz
jekyll-theme-5539d13170e51e1877bf6e070e22e197656e48d9.zip
sidebar: factor out the "entry" include
Diffstat (limited to '')
-rw-r--r--_includes/common/sidebar.html78
-rw-r--r--_includes/common/sidebar_entry.html4
2 files changed, 46 insertions, 36 deletions
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 %}
<div class="row">
- <div class="col-xs-12 col-sm-6 col-md-12">
- <h4>About</h4>
- {% 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 %}
- <p>{{ project_desc }}</p>
- <div class="list-group wide-enough">
- {% 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 %}<span class="glyphicon glyphicon-{{ github_icon }}"></span>&nbsp;{% endcapture %}
- <a class="list-group-item" href="{{ site.github.repository_url }}" target="_blank">{{ github_icon }}{{ github_link }}</a>
- {% endif %}
- {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %}
- <a class="list-group-item" href="mailto:{{ author_email }}"><span class="glyphicon glyphicon-envelope"></span>&nbsp;{{ author_email }}</a>
- </div>
- </div>
- {% if site.posts.size > 0 %}
- <div class="col-xs-12 col-sm-6 col-md-12">
- <h4>Latest posts</h4>
- <div class="list-group wide-enough">
- {% for post in site.posts limit: 5 %}
- <a class="list-group-item" href="{{ post.url | relative_url }}">
- <span class="badge"><span class="glyphicon glyphicon-time"></span>&nbsp;{{ post.date | date: '%-d %b %Y' }}</span>
- <span class="glyphicon glyphicon-file"></span>&nbsp;{{ post.title }}
- </a>
- {% endfor %}
- </div>
- </div>
+
+{% 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 %}
+<p>{{ project_desc }}</p>
+<div class="list-group wide-enough">
+ {% 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 %}<span class="glyphicon glyphicon-{{ github_icon }}"></span>&nbsp;{% endcapture %}
+ <a class="list-group-item" href="{{ site.github.repository_url }}" target="_blank">{{ github_icon }}{{ github_link }}</a>
+ {% endif %}
+ {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %}
+ <a class="list-group-item" href="mailto:{{ author_email }}"><span class="glyphicon glyphicon-envelope"></span>&nbsp;{{ author_email }}</a>
+</div>
+{% endcapture %}
+
+{% include common/sidebar_entry.html header='About' content=about_content %}
+
+{% if site.posts.size > 0 %}
+
+{% capture latest_posts_content %}
+<div class="list-group wide-enough">
+ {% for post in site.posts limit: 5 %}
+ <a class="list-group-item" href="{{ post.url | relative_url }}">
+ <span class="badge"><span class="glyphicon glyphicon-time"></span>&nbsp;{{ post.date | date: '%-d %b %Y' }}</span>
+ <span class="glyphicon glyphicon-file"></span>&nbsp;{{ post.title }}
+ </a>
+ {% endfor %}
+</div>
+{% endcapture %}
+
+{% include common/sidebar_entry.html header='Latest posts' content=latest_posts_content %}
+{% endif %}
+
</div>
{% 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 @@
+<div class="col-xs-12 col-sm-6 col-md-12">
+ <h4>{{ include.header }}</h4>
+ {{ include.content }}
+</div>