Skip to content

Instantly share code, notes, and snippets.

@mariohernandez
Created February 11, 2019 02:51
Show Gist options
  • Save mariohernandez/ec9337b2e5c54f67350a08a0f3d5a0de to your computer and use it in GitHub Desktop.
Save mariohernandez/ec9337b2e5c54f67350a08a0f3d5a0de to your computer and use it in GitHub Desktop.
{% import _self as menus %}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes }}>
{% else %}
<ul>
{% endif %}
{% for item in items %}
<li{{ item.attributes }}>
{{ link(item.title, item.url) }}
{% if item.below %}
{{ menus.menu_links(item.below, attributes, menu_level + 1) }}
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment