{% macro nav_loop(page) %}
  {% import _self as macros %}
  {% for p in page.children.visible %}
    {% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
    {% set has_children = p.children.visible.count > 0 %}
    <li{% if has_children %} class="has-children"{% endif %}>
      <a href="{{ p.url }}" class="{{ active_page }}">
        {% if p.header.menu_icon %}<i class="fa-solid fa-{{ p.header.menu_icon }}" aria-hidden="true"></i>{% endif %}
        {{ p.menu }}
      </a>
      {% if has_children %}
      <ul>
        {{ macros.nav_loop(p) }}
      </ul>
      {% endif %}
    </li>
  {% endfor %}
{% endmacro %}
