From 0900f2910e908ff8c997b684c2f7ae69791f50de Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 1 Jun 2022 16:41:21 +0200 Subject: Hierarchical navigation menu --- templates/index.html | 56 +++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) (limited to 'templates/index.html') diff --git a/templates/index.html b/templates/index.html index 54fb473..004a4fa 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,5 @@ {% import "_macros.html" as macros %} +{% import "_nav.html" as nav %} @@ -7,7 +8,7 @@ {% block title %}{{ config.title }}{% endblock title %} {% block favicon %} - + {% endblock favicon %} {% include "_variables.html" %} @@ -24,46 +25,21 @@ {% endblock header %}
- {% block toc %} - {% if page.ancestors %} - {% set section = get_section(path=page.ancestors | last) %} - {% endif %} - {% if section.ancestors %} - {% set parent = get_section(path=section.ancestors | last) %} - {% endif %} + {% block toc %}
-
- - {% if section.subsections %} - {% for s in section.subsections %} - {% set p = get_section(path=s) %} - - {% endfor %} - {% endif %} - - {% if section.pages %} - {% for p in section.pages %} - - {% endfor %} - {% endif %} - {% if parent %} - - {% endif %} -
+
+ {% if page %} + {{ nav::navmenu(current=page) }} + {% else %} + {{ nav::navmenu(current=section) }} + {% endif %} +
- {% endblock toc %} + {% endblock toc %}
{% block content %} -
{{ section.title }}
+
{{ section.title }}
{{ section.content | safe }} {% endblock content %}
@@ -75,10 +51,10 @@ {% block footer %} {% endblock footer %} -- cgit v1.2.3