aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_includes
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-04-10 13:03:02 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-04-10 13:03:02 +0300
commit8e11e56f51c425e3771c297cd44174afb2778281 (patch)
tree6228147204dc80e0ccba7805781bffdcedc3a853 /_includes
parentbump Bootstrap to 3.4.1 (diff)
downloadjekyll-theme-8e11e56f51c425e3771c297cd44174afb2778281.tar.gz
jekyll-theme-8e11e56f51c425e3771c297cd44174afb2778281.zip
navbar: rework front matter interface
Diffstat (limited to '')
-rw-r--r--_includes/common/navbar.html19
1 files changed, 12 insertions, 7 deletions
diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html
index 9f01639..7e5fa4e 100644
--- a/_includes/common/navbar.html
+++ b/_includes/common/navbar.html
@@ -11,32 +11,37 @@
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
- {% assign page_list = site.pages | where_exp: "x","x.navbar_link" | sort: "navbar_priority" %}
+ {% assign page_list = site.pages | where_exp: "x","x.navbar.link" | sort: "navbar.priority" %}
{% for node in page_list %}
{% comment %}
Whether a page should be present in the navbar is determined by
- the presense of navbar_link in the page's front matter. It can be
+ the presense of navbar.link in the page's front matter. It can be
true, in which case page's title is used, or it can be custom HTML.
If the page is paginated, it should be marked as such by setting
- navbar_paginated to true in its front matter. That way, /pageN/
+ navbar.paginated to true in its front matter. That way, /pageN/
pages, which would have the same navbar_link, wouldn't appear in
the navbar.
{% endcomment %}
- {% if node.navbar_paginated %}
+ {% if node.navbar.paginated %}
{% if navbar_has_paginated %}
{% continue %}
{% endif %}
{% assign navbar_has_paginated = true %}
{% endif %}
- {% assign link = node.navbar_link %}
+ {% assign link = node.navbar.link %}
{% if link == true %}
{% assign link = node.title %}
{% endif %}
+ {% capture link %}{{ link | upcase }}{% endcapture %}
+ {% assign icon = node.navbar.icon %}
+ {% if icon %}
+ {% capture icon %}<span class="glyphicon glyphicon-{{ icon }}"></span>&nbsp;{% endcapture %}
+ {% endif %}
{% if page.url == node.url %}
- <li class="active"><a href="{{ node.url | relative_url }}" class="active">{{ link }}</a></li>
+ <li class="active"><a href="{{ node.url | relative_url }}" class="active">{{ icon }}{{ link }}</a></li>
{% else %}
- <li><a href="{{ node.url | relative_url }}">{{ link }}</a></li>
+ <li><a href="{{ node.url | relative_url }}">{{ icon }}{{ link }}</a></li>
{% endif %}
{% endfor %}
</ul>