Build navigation list include helper
- Update navigation.yml to support multiple navigations and levels - Optional include navigation into left sidebar
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
<nav id="site-nav" class="greedy-nav">
|
||||
<button><div class="navicon"></div></button>
|
||||
<ul class="visible-links">
|
||||
{% for link in site.data.navigation %}
|
||||
{% for link in site.data.navigation.main %}
|
||||
{% if link.url contains 'http' %}
|
||||
{% assign domain = '' %}
|
||||
{% else %}
|
||||
|
24
_includes/nav_list.html
Normal file
24
_includes/nav_list.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% include base_path %}
|
||||
{% assign navigation = site.data.navigation[page.sidebar.nav] %}
|
||||
|
||||
<nav>
|
||||
<ul>
|
||||
{% for nav in navigation %}
|
||||
<li>{{ nav.title }}
|
||||
{% if nav.children != null %}
|
||||
<ul>
|
||||
{% for child in nav.children %}
|
||||
{% assign nav_url = child.path | prepend: "/" | prepend: page.sidebar.nav | prepend: "/" | append: "/" | prepend: base_path %}
|
||||
{% if nav_url contains page.url %}
|
||||
{% assign c = "current" %}
|
||||
{% else %}
|
||||
{% assign c = "" %}
|
||||
{% endif %}
|
||||
<li><a href="{{ nav_url }}" class="{{ c }}">{{ child.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
@ -15,6 +15,9 @@
|
||||
{% if s.title %}<h3>{{ s.title }}</h3>{% endif %}
|
||||
{% if s.text %}{{ s.text | markdownify }}{% endif %}
|
||||
{% endfor %}
|
||||
{% if page.sidebar.nav %}
|
||||
{% include nav_list.html items=page.sidebar.nav %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
Reference in New Issue
Block a user