{% assign sorted_pages = site.pages | sort: 'weight'%} {% if site.data.nav %}

{% assign sorted_pages = sorted_pages | concat: site.data.nav | sort: 'weight' %}

{% endif %} {% for node in sorted_pages %}

{% if node.menu != false %}
  {% if node.menu or node.title %}
    {% unless node.parent %}
      <a class="mdl-navigation__link parent{% if node.url == page.url or page.parent and page.parent == node.path %} is-active{% endif %}" href="{{ node.url | absolute_url }}"{% if node.tab %} target="_blank"{% endif %}>{% if node.menu %}{{ node.menu }}{% else %}{{ node.title }}{% endif %}</a>
      {% if site.menu_style != 'dropdown' or node.url == page.url or page.parent and page.parent == node.path %}
        {% for child in sorted_pages %}
          {% if child.menu != false %}
            {% if child.menu or child.title %}
              {% if child.parent %}
                {% if child.parent == node.path or child.parent == node.id %}
                  <a class="mdl-navigation__link child{% if child.url == page.url %} is-active{% endif %}" href="{{ child.url | absolute_url }}"{% if child.tab %} target="_blank"{% endif %}>{% if child.menu %}{{ child.menu }}{% else %}{{ child.title }}{% endif %}</a>
                {% endif %}
              {% endif %}
            {% endif %}
          {% endif %}
        {% endfor %}
      {% endif %}
    {% endunless %}
  {% endif %}
{% endif %}

{% endfor %}