enigma-bbs/docs/_includes/nav.html

71 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2022-02-04 14:51:03 +00:00
<ul>
{% for doc in site.docs %}
{% assign pathparts = doc.path | split: '/' %}
{% assign dir = pathparts[1] %}
{% if pathparts.size > 3 %}
{% assign subdir = pathparts[2] %}
{% unless site.data.sections[subdir] %}
{% assign subsection = subdir %}
{% else %}
{% assign subsection = site.data.sections[subdir].title %}
{% endunless %}
{% else %}
{% assign subdir = "NONE" %}
{% endif %}
{% assign section = site.data.sections[dir].title %}
{% unless section %}
{% assign section = dir %}
{% endunless %}
{% if doc.previous %}
{% assign prevpathparts = doc.previous.path | split: '/' %}
{% assign prevdir = prevpathparts[1] %}
{% if prevpathparts.size > 3 %}
{% assign prevsubdir = prevpathparts[2] %}
{% else %}
{% assign prevsubdir = "NONE" %}
{% endif %}
{% else %}
{% assign prevdir = "NONE" %}
{% assign prevsubdir = "NONE" %}
{% endif %}
{% if subdir != prevsubdir and prevsubdir != "NONE" %}
</ul>
{% endif %}
{% if dir != prevdir %}
{% if prevdir != "NONE" %}
</ul>
{% endif %}
<li>{{section}}</li>
<ul>
{% endif %}
2022-02-04 14:51:03 +00:00
{% if subdir != "NONE" and subdir != prevsubdir %}
2022-02-04 14:51:03 +00:00
<li>{{subsection}}</li>
<ul>
{% endif %}
{% if doc.url != page.url %}
<li><a href="{{site.baseurl}}{{doc.url}}">{{doc.title}}</a></li>
2022-02-04 14:51:03 +00:00
{% else %}
<li class="active-nav">{{doc.title}}</li>
{% endif %}
{% unless doc.next %}
</ul>
{% if prevsubdir != "NONE" %}
</ul>
{% endif %}
{% endunless %}
{% endfor %}
</ul>