{% macro nav_loop(page) %}
  {% import _self as macros %}
  {% for p in page.children.visible if p.template != 'home' %}
    {% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
    {% if p.children.visible.count > 0 %}
      <li>
        <a class="no-click" href="{{ p.url }}"{{ active_page }}>
          {{ p.menu }}
        </a>
        <ul>
          {% for i in p.children.visible %}
          <li>
            {% if i.header.redirect %}
                <a href="{{ i.header.redirect }}"{{ active_page }} target="_blank">
                {{ i.menu }}
                </a>
            {% else %}
                <a href="{{ i.url }}"{{ active_page }}>
                    {{ i.menu }}
                </a>
            {% endif %}
          </li>
          {% endfor %}
        </ul>
      </li>
    {% else %}
      <li>
      {% if p.header.redirect %}
        <a href="{{ p.header.redirect }}" target="_blank">
            {{ p.menu }}
        </a>
      {% else %}
        <a href="{{ p.url }}">
            {{ p.menu }}
        </a>
      {% endif %}

      </li>
    {% endif %}
  {% endfor %}
{% endmacro %}
