Skip to content

Instantly share code, notes, and snippets.

@gkatsanos
Created April 21, 2017 09:18
Show Gist options
  • Save gkatsanos/40f9175a8c562339375969597450fc05 to your computer and use it in GitHub Desktop.
Save gkatsanos/40f9175a8c562339375969597450fc05 to your computer and use it in GitHub Desktop.
{% macro menu_links(items, attributes, menu_level, current_path) %}
{% import _self as menus %}
{% if items %}
{% if menu_level != 0 %}
<ul class="list-unstyled font-title font-small text-capitalize line-height-l level-{{ menu_level }}">
{% endif %}
{% for i, item in items %}
{% if menu_level == 0 %}
<div class="col-sm-3">
<p class="font-title margin-top-m margin-bottom-l">{{ link(item.title, item.url, { 'class':['link-white']}) }}</p>
{% else %}
<li{{ item.attributes }}{% if item.in_active_trail == true or item.url.tostring == current_path %} class="active"{% endif %}>
<a class="font-title-reg text-light-gray" href="{{ item.url }}">{{ item.title }}</a>
</li>
{% endif %}
{% if item.below %}
{{ menus.menu_links(item.below, attributes, menu_level + 1, current_path) }}
{% endif %}
{% if menu_level == 0 %}
</div>
{% endif %}
{% endfor %}
{% if menu_level != 0 %}
</ul>
{% endif %}
{% endif %}
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment