From 4723776beee0ac571d826e8598e8ec3a5359729b Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Sun, 25 Jun 2017 07:17:43 +0300
Subject: fix navbar links with multiple pages

I determine whether a page should be present in the navigation bar by
checking if 'navbar' is present in this page's `groups`.
My posts/index.html is an example of such page.
But `jekyll-paginate` creates a bunch of similar pages, each of them
having 'navbar' in their `groups`.
Thus, every /posts//pageN appears in the navbar.
To get rid of all of them except for the first one, I set `root_page` to
`true` in index.html, and only include the first page with `root_page ==
true` in the navbar.
Man, it's a hack if I've ever seen one.
---
 _includes/common/navbar.html | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to '_includes')

diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html
index ea0bae7..d2f5ea3 100644
--- a/_includes/common/navbar.html
+++ b/_includes/common/navbar.html
@@ -12,6 +12,12 @@
     <div class="navbar-collapse collapse">
       <ul class="nav navbar-nav">
         {% for node in site.pages %}
+          {% if node.root_page %}
+            {% if navbar_has_root_page %}
+              {% continue %}
+            {% endif %}
+            {% assign navbar_has_root_page = true %}
+          {% endif %}
           {% if node.groups contains 'navbar' %}
             {% if page.url == node.url %}
               <li class="active"><a href="{{ site.baseurl }}{{ node.url }}" class="active">{{ node.navbar_link }}</a></li>
-- 
cgit v1.2.3