1
0
mirror of https://github.com/picocms/pico-theme.git synced 2025-07-25 19:11:49 +02:00

Use Twig pages function for navigation

See 681ad27158 for more info
This commit is contained in:
Daniel Rudolf
2019-10-01 13:32:20 +02:00
parent 470a734034
commit 138a88e05f

View File

@@ -32,13 +32,10 @@
</h1> </h1>
<div id="nav" role="region" tabindex="-1"> <div id="nav" role="region" tabindex="-1">
<ul> <ul>
{% for page in pages if page.title and not page.hidden %} {% for page in pages(depthOffset=-1) if page.title and not page.hidden %}
{% set pageDepth = page.id|split('/')|length %} <li{% if page.id == current_page.id %} class="active"{% endif %}>
{% if (pageDepth == 2) and (page.id ends with "/index") or (pageDepth == 1) %} <a href="{{ page.url }}">{{ page.title }}</a>
<li{% if page.id == current_page.id %} class="active"{% endif %}> </li>
<a href="{{ page.url }}">{{ page.title }}</a>
</li>
{% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>