From 138a88e05f9416961100a0c99757cc3d8a8853d4 Mon Sep 17 00:00:00 2001
From: Daniel Rudolf <github.com@daniel-rudolf.de>
Date: Tue, 1 Oct 2019 13:32:20 +0200
Subject: [PATCH] Use Twig pages function for navigation

See https://github.com/picocms/Pico/commit/681ad2715870df3bf5e052bccc34eb9e8f90aaa9 for more info
---
 index.twig | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

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