{# Recursive: nav depth is unbounded, so a section includes this same template for each of its children. The inner `for` rebinds `nav_item` in loop scope, which is what makes the recursion work (same trick as mkdocs-basic-theme). #} {%- if nav_item.children %}
{# A section normally has no url. mkdocs-section-index gives it one by folding the section's index page into the section itself, and then the label is the only route to that page — rendering it as inert text drops the page out of the nav entirely. #} {# `active` is true for a section anywhere above the current page, which is the only signal the tree has for "you are in here" — the leaf item's aria-current says nothing about its ancestors. #} {%- set section_label_class = 'primer-nav-section-label' ~ (' primer-nav-section-label-active' if nav_item.active else '') %} {%- if nav_item.url %} {{ nav_item.title }} {%- else %}
{{ nav_item.title }}
{%- endif %}
{%- for nav_item in nav_item.children %} {% include "partials/nav-item.html" %} {%- endfor %}
{%- else %} {{ nav_item.title }} {%- endif %}