diff options
author | uvok cheetah | 2024-12-17 18:32:58 +0100 |
---|---|---|
committer | uvok cheetah | 2024-12-17 18:32:58 +0100 |
commit | 05b4da4026658b4744156ea0f03e753ca84ce9f2 (patch) | |
tree | 1becf30e9cc5ac9d1a3dacf1690eed8acfe891f6 | |
parent | f5e9445b315d0b0eeca40968ae8b69a3229569ea (diff) |
Extract navbar links
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 3 | ||||
-rw-r--r-- | _includes/header.html | 15 | ||||
-rw-r--r-- | _includes/navlinks.html | 11 |
4 files changed, 16 insertions, 14 deletions
@@ -14,3 +14,4 @@ group :jekyll_plugins do gem 'jekyll-compose', '~> 0.12.0' end +gem "jekyll-include-cache", "~> 0.2.1", :group => :jekyll_plugins diff --git a/Gemfile.lock b/Gemfile.lock index acf8e9a..1bf7e31 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -46,6 +46,8 @@ GEM jekyll (>= 3.7, < 5.0) jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) jekyll-paginate-v2 (3.0.0) jekyll (>= 3.0, < 5.0) jekyll-redirect-from (0.16.0) @@ -108,6 +110,7 @@ DEPENDENCIES jekyll (~> 4.2) jekyll-compose (~> 0.12.0) jekyll-feed (~> 0.17) + jekyll-include-cache (~> 0.2.1) jekyll-paginate-v2 (~> 3.0) jekyll-redirect-from (~> 0.16.0) jekyll-tidy (~> 0.2.2) diff --git a/_includes/header.html b/_includes/header.html index 4663f3d..492dcd5 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -2,7 +2,6 @@ <!-- built from {% git_rev %} --> <div class="wrapper"> <a class="site-title" rel="author" href="{{ "/index.html" | relative_url }}">{{ site.title | escape }}</a> - <nav class="site-nav"> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger"> @@ -12,20 +11,8 @@ </svg> </span> </label> - <div class="trigger" lang="en"> - {% comment %} - my_page.autogen is populated by the pagination logic for all pages - that are automatically created by the gem. Check for non-existence to exclude pagination pages from site.pages iterators - ^-- alt: check for content - add exclusion of /index to avoid having the link twice - {% endcomment %} - {% assign spag = site.pages | sort: "order" %} - {% for my_page in spag %} - {% if my_page.title and my_page.content and my_page.url != "/index.html" and my_page.in_navbar %} - <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a> - {% endif %} - {% endfor %} + {% include_cached navlinks.html %} <a class="page-link" href="https://uvokchee.de/wiki/">Wiki</a> <a class="rss-subscribe page-link" href="{{ "/feed.xml" | relative_url }}">RSS feed</a> </div> diff --git a/_includes/navlinks.html b/_includes/navlinks.html new file mode 100644 index 0000000..93dfbf6 --- /dev/null +++ b/_includes/navlinks.html @@ -0,0 +1,11 @@ + {% comment %} + my_page.autogen is populated by the pagination logic for all pages that are automatically created by the gem. Check for non-existence to exclude pagination pages from site.pages iterators + ^-- alt: check for content + add exclusion of /index to avoid having the link twice + {% endcomment %} + {% assign spag = site.pages | sort: "order" %} + {% for my_page in spag %} + {% if my_page.title and my_page.content and my_page.url != "/index.html" and my_page.in_navbar %} + <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a> + {% endif %} + {% endfor %} |