{# Navigation Node Component (Recursive) Renders a single NavNodeProxy with its children. Variables: - item: NavNodeProxy to render (required) - depth: Current nesting depth for styling (required) - show_nav_icons: Whether to show section icons (default: true) Features: - Collapsible sections with toggle button - Simple link rendering for leaf nodes - Active page highlighting via item.is_current - Active trail via item.is_in_trail - Recursive rendering of children Usage: {% set depth = 0 %} {% include 'partials/docs-nav-node.html' %} #} {% set show_nav_icons = show_nav_icons if show_nav_icons is defined else true %} {% set item_title = item.title %} {% set item_icon = item.icon %} {% if item.has_children %} {# ===== ROOT NODE (depth 0) - Static header, no toggle ===== #} {% if depth == 0 %}
{% if show_nav_icons %} {{ icon(item_icon or 'folder', size=16) }} {% endif %} {% if item.href %} {{ item_title }} {% else %} {{ item_title }} {% endif %}
{% for child in item.children %} {% set item = child %} {% set depth = depth + 1 %} {% include 'partials/docs-nav-node.html' %} {% endfor %}
{% else %} {# ===== EXPANDABLE NODE (has children, depth > 0) ===== #}
{% if show_nav_icons %} {{ icon(item_icon or 'folder', size=16) }} {% endif %} {% if item.href %} {{ item_title }} {% else %} {{ item_title }} {% endif %}
{% endif %} {% else %} {# ===== LEAF NODE (no children) ===== #}
{% if item.href %} {% if show_nav_icons and item.is_section %} {{ icon(item_icon or 'folder', size=14) }} {% endif %} {{ item_title }} {% else %} {% if show_nav_icons and item.is_section %} {{ icon(item_icon or 'folder', size=14) }} {% endif %} {{ item_title }} {% endif %}
{% endif %}