mirror of
https://github.com/thangisme/notes.git
synced 2024-11-08 11:57:25 -05:00
73ad860f8e
Co-Authored-By: Patrick Marsceill <pmarsceill@users.noreply.github.com>
52 lines
3.1 KiB
HTML
52 lines
3.1 KiB
HTML
<nav role="navigation" aria-label="Main navigation">
|
|
<ul class="navigation-list">
|
|
{%- assign ordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order != nil" -%}
|
|
{%- assign unordered_pages_list = site.html_pages | where_exp:"item", "item.nav_order == nil" -%}
|
|
{%- if site.nav_sort == 'case_insensitive' -%}
|
|
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort_natural:"nav_order" -%}
|
|
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort_natural:"title" -%}
|
|
{%- else -%}
|
|
{%- assign sorted_ordered_pages_list = ordered_pages_list | sort:"nav_order" -%}
|
|
{%- assign sorted_unordered_pages_list = unordered_pages_list | sort:"title" -%}
|
|
{%- endif -%}
|
|
{%- assign pages_list = sorted_ordered_pages_list | concat: sorted_unordered_pages_list -%}
|
|
{%- for node in pages_list -%}
|
|
{%- unless node.nav_exclude -%}
|
|
{%- if node.parent == nil -%}
|
|
<li class="navigation-list-item{% if page.url == node.url or page.parent == node.title or page.grand_parent == node.title %} active{% endif %}">
|
|
{%- if page.parent == node.title or page.grand_parent == node.title -%}
|
|
{%- assign first_level_url = node.url | absolute_url -%}
|
|
{%- endif -%}
|
|
<a href="{{ node.url | absolute_url }}" class="navigation-list-link{% if page.url == node.url %} active{% endif %}">{{ node.title }}</a>
|
|
{%- if node.has_children -%}
|
|
{%- assign children_list = pages_list | where: "parent", node.title -%}
|
|
<ul class="navigation-list-child-list ">
|
|
{%- for child in children_list -%}
|
|
{%- unless child.nav_exclude -%}
|
|
<li class="navigation-list-item {% if page.url == child.url or page.parent == child.title %} active{% endif %}">
|
|
{%- if page.url == child.url or page.parent == child.title -%}
|
|
{%- assign second_level_url = child.url | absolute_url -%}
|
|
{%- endif -%}
|
|
<a href="{{ child.url | absolute_url }}" class="navigation-list-link{% if page.url == child.url %} active{% endif %}">{{ child.title }}</a>
|
|
{%- if child.has_children -%}
|
|
{%- assign grand_children_list = pages_list | where: "parent", child.title -%}
|
|
<ul class="navigation-list-child-list">
|
|
{%- for grand_child in grand_children_list -%}
|
|
<li class="navigation-list-item {% if page.url == grand_child.url %} active{% endif %}">
|
|
<a href="{{ grand_child.url | absolute_url }}" class="navigation-list-link{% if page.url == grand_child.url %} active{% endif %}">{{ grand_child.title }}</a>
|
|
</li>
|
|
{%- endfor -%}
|
|
</ul>
|
|
{%- endif -%}
|
|
</li>
|
|
{%- endunless -%}
|
|
{%- endfor -%}
|
|
</ul>
|
|
{%- endif -%}
|
|
</li>
|
|
{%- endif -%}
|
|
{%- endunless -%}
|
|
{%- endfor -%}
|
|
</ul>
|
|
</nav>
|