{% macro nav_loop_as_details(page) %}
  {% import _self as macros %}
  {% for p in page.children.visible %}
    {% set active_page = (p.active or p.activeChild) ? ' class="active"' : '' %}
    {% if p.children.visible.count > 0 %}
      <li>
      <details>
        <summary>
          <a href="{{ p.url }}"{{ active_page }}>
            {{ p.menu }}
          </a>
        </summary>
        <ul>
          {{ macros.nav_loop_as_details(p) }}
        </ul>
      </details>
      </li>
    {% else %}
      <li>
        <a href="{{ p.url }}"{{ active_page }}>
          {{ p.menu }}
        </a>
      </li>
    {% endif %}
  {% endfor %}
{% endmacro %}

