{# 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. #} {%- 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 %}