diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-09 19:51:39 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-04-09 19:51:39 +0300 |
commit | 5a11bfa1da49524f09149916221adbaeba1c19a7 (patch) | |
tree | 2f4a333b1b6121d055f4b0867526d50f6815f067 | |
parent | put theme settings under site.settings (diff) | |
download | jekyll-theme-5a11bfa1da49524f09149916221adbaeba1c19a7.tar.gz jekyll-theme-5a11bfa1da49524f09149916221adbaeba1c19a7.zip |
navbar: simpler & more robust
Diffstat (limited to '')
-rw-r--r-- | _includes/common/navbar.html | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html index 1da4b5a..a255619 100644 --- a/_includes/common/navbar.html +++ b/_includes/common/navbar.html @@ -11,20 +11,22 @@ </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> - {% assign page_list = site.pages | sort: "navbar_priority" %} + {% assign page_list = site.pages | where_exp: "x","x.navbar_link" | sort: "navbar_priority" %} {% for node in page_list %} - {% if node.root_page %} - {% if navbar_has_root_page %} + {% if node.navbar_paginated %} + {% if navbar_has_paginated %} {% continue %} {% endif %} - {% assign navbar_has_root_page = true %} + {% assign navbar_has_paginated = true %} {% endif %} - {% if node.groups contains 'navbar' %} - {% if page.url == node.url %} - <li class="active"><a href="{{ node.url | relative_url }}" class="active">{{ node.navbar_link }}</a></li> - {% else %} - <li><a href="{{ node.url | relative_url }}">{{ node.navbar_link }}</a></li> - {% endif %} + {% assign link = node.navbar_link %} + {% if link == true %} + {% assign link = node.title %} + {% endif %} + {% if page.url == node.url %} + <li class="active"><a href="{{ node.url | relative_url }}" class="active">{{ link }}</a></li> + {% else %} + <li><a href="{{ node.url | relative_url }}">{{ link }}</a></li> {% endif %} {% endfor %} </ul> |