From 5c569ca60837f88d96df6429cfe687c55792b138 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 24 Mar 2022 13:07:09 +0300 Subject: show notes on the sidebar on some pages --- _config.yml | 2 +- _includes/custom-sidebar.html | 8 ++++++++ _includes/notes.html | 19 +++++++++++++++++++ all/index.html | 5 +++++ index.html | 5 ++++- notes/index.html | 12 +----------- 6 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 _includes/custom-sidebar.html create mode 100644 _includes/notes.html diff --git a/_config.yml b/_config.yml index 47ed813..f8a9e84 100644 --- a/_config.yml +++ b/_config.yml @@ -53,7 +53,7 @@ repository: egor-tensin/blog # jekyll-paginate paginate: 10 # jekyll-remote-theme -remote_theme: egor-tensin/jekyll-theme@7a358a1407e8b32cd36ebd85295099340557151f +remote_theme: egor-tensin/jekyll-theme@5e25c497c37c39d399d0851f316aa5783d536347 # Theme settings settings: diff --git a/_includes/custom-sidebar.html b/_includes/custom-sidebar.html new file mode 100644 index 0000000..3bd83aa --- /dev/null +++ b/_includes/custom-sidebar.html @@ -0,0 +1,8 @@ +{% if page.sidebar.notes.show %} + +{% capture notes %} +{% include notes.html sidebar=true %} +{% endcapture %} +{% include jekyll-theme/sidebar/entry.html header='Notes' content=notes %} + +{% endif %} diff --git a/_includes/notes.html b/_includes/notes.html new file mode 100644 index 0000000..25c8049 --- /dev/null +++ b/_includes/notes.html @@ -0,0 +1,19 @@ +{% comment %} + Sorting can be done in _config.yml with Jekyll 4.0 or later. +{% endcomment %} +{% assign note_list = site.notes | sort_natural: 'title' %} +
+ {% for note in note_list %} + + {% if include.sidebar %} + {{ note.subtitle }} +  {{ note.title }} + {% else %} +
+ {{ note.title }} + {{ note.subtitle }} +
+ {% endif %} +
+ {% endfor %} +
diff --git a/all/index.html b/all/index.html index b3aa9de..3a0a88d 100644 --- a/all/index.html +++ b/all/index.html @@ -4,5 +4,10 @@ layout: default navbar: link: Archive priority: 2 +sidebar: + latest_posts: + hide: true + notes: + show: true --- {% include jekyll-theme/categories/all.html %} diff --git a/index.html b/index.html index 61d0c58..8fc200a 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,9 @@ navbar: priority: 1 paginated: true sidebar: - hide: true + latest_posts: + hide: true + notes: + show: true --- {% include jekyll-theme/posts/feed.html %} diff --git a/notes/index.html b/notes/index.html index da03827..1351be1 100644 --- a/notes/index.html +++ b/notes/index.html @@ -5,18 +5,8 @@ navbar: priority: 3 --- {% if site.notes.size > 0 %} - {% comment %} - Sorting can be done in _config.yml with Jekyll 4.0 or later. - {% endcomment %} - {% assign note_list = site.notes | sort_natural: 'title' %}

Style guides and best practices, not worthy of a post.

-
- {% for note in note_list %} - -

{{ note.title }} {{ note.subtitle }}

-
- {% endfor %} -
+ {% include notes.html %} {% else %}

Sorry, no notes have been added yet.

{% endif %} -- cgit v1.2.3