refactor how global menu is compiled; also add an option to hide home item

This commit is contained in:
rzen 2020-06-02 21:03:13 -04:00
parent ca203b3325
commit 8990aa978c

View File

@ -1,16 +1,25 @@
<header>
<nav>
<ul>
<li><a href="{{ site.baseurl | append: '/' }}">{{ site.nav.home | default: "Home" }}</a>
{% if jekyll.environment == 'local' %}
<li><a href="{{ site.baseurl | append: '/private/' }}">Private</a>
{% if site.home.hide_home %}
<!-- home menu hidden per _config.yaml nav.hide_home_link -->
{% else %}
<li><a href="{{ '/' | relative_url }}">{{ site.nav.home | default: "Home" }}</a>
{% endif %}
{% for page in site.pages | sort: 'sort_order', 'title' %}
{% assign sorted_pages=(site.pages | sort: "sort_order") %}
{% for page in sorted_pages %}
{% if page.categories contains 'global' %}
<li><a href="{{ site.baseurl | append: page.url }}">{{ page.title }}</a>
<li><a href="{{ page.url | relative_url }}">{{ page.title }}</a>
{% endif %}
{% endfor %}
{% include additional_glboal_nav.html %}
{% if jekyll.environment == 'local' %}
<li><a href="{{ '/private/' | relative_url }}">Private</a>
{% endif %}
</ul>
</nav>
</header>