Skip to content

Instantly share code, notes, and snippets.

@mig1098
Last active October 13, 2016 07:19
Show Gist options
  • Save mig1098/3d32c54efc7a840f711a to your computer and use it in GitHub Desktop.
Save mig1098/3d32c54efc7a840f711a to your computer and use it in GitHub Desktop.
{% for link in linklists.main-menu.links %}
{% comment %}
Create a dropdown menu by naming a linklist the same as a link in the parent nav
More info on dropdowns:
- http://docs.shopify.com/manual/your-website/navigation/create-drop-down-menu
{% endcomment %}
{% assign child_list_handle = link.title | handleize %}
{% if linklists[child_list_handle].links != blank %}
<li class="site-nav__item site-nav__expanded-item site-nav--has-dropdown{% unless template == 'index' %}{% if link.active %} site-nav--active{% endif %}{% endunless%}" aria-haspopup="true">
<a href="{{ link.url }}" class="site-nav__link">
{{ link.title }}
<span class="icon icon-arrow-down" aria-hidden="true"></span>
</a>
<ul class="site-nav__dropdown text-left">
{% for childlink in linklists[child_list_handle].links %}
<li{% if childlink.active %} class="site-nav--active"{% endif %}>
<a href="{{ childlink.url }}" class="site-nav__dropdown-link">{{ childlink.title | escape }} - {{ childlink.handle }}</a>
{% comment %}
-- create sub list dropdown --
{% endcomment %}
{% assign mg_child = childlink.title | handleize %}
{% if linklists[mg_child].links != blank %}
<ul class="mg-dropdown">
{% for childlink2 in linklists[mg_child].links %}
<li>{{ childlink2.title }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</li>
{% else %}
<li class="site-nav__item site-nav__expanded-item{% unless template == 'index' %}{% if link.active %} site-nav--active{% endif %}{% endunless%}">
<a href="{{ link.url }}" class="site-nav__link">{{ link.title }}</a>
</li>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment