{% macro navsection(hierarchy, level, current) %} {% set sec = hierarchy | nth(n=level) %} {% set sec = get_section(path=sec) %} {% set maxlevel = hierarchy | length %} {% if sec.subsections %} {% for s in sec.subsections %} {% set p = get_section(path=s) %}
{% if p.path == current.path %} {{ p.title }} {% elif hierarchy is containing(s) %} ⯆ {{ p.title }} {% else %} ⯈ {{ p.title }} {% endif %} {% if hierarchy is containing(s) or current.path == p.path %} {% if level + 1 < maxlevel %} {{ nav::navsection(hierarchy=hierarchy,level=level + 1,current=current) }} {% endif %} {% endif %}
{% endfor %} {% endif %} {% if sec.pages %} {% for p in sec.pages %}
{% if p.path == current.path %}   {{ p.title }} {% else %}   {{ p.title }} {% endif %}
{% endfor %} {% endif %} {% endmacro navsection %} {% macro navmenu(current) %} {% if current.ancestors %} {% set hierarchy = current.ancestors | concat(with=current.relative_path) %} {% else %} {% set hierarchy = [current.relative_path] %} {% endif %} {% set root_path = hierarchy | nth(n=0) %} {% set root = get_section(path=root_path) %}
{{ root.title }}
{{ nav::navsection(hierarchy=hierarchy,level=0,current=current) }} {% endmacro %}