mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
40 lines
No EOL
1.2 KiB
Twig
40 lines
No EOL
1.2 KiB
Twig
{# MACRO FOR PAGE-TOC PLUGIN SUPPORT #}
|
|
|
|
{% macro toc_loop(items) %}
|
|
{% import _self as toc_macros %}
|
|
{% for item in items %}
|
|
{% set class = loop.first ? 'first' : loop.last ? 'last' : null %}
|
|
<li {% if class %}class="{{ class }}"{% endif %}>
|
|
<a href="{{ item.uri }}">{{ item.label }}</a>
|
|
{% if item.children|length > 0 %}
|
|
<ul>
|
|
{{ toc_macros.toc_loop(item.children) }}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
{% endmacro %}
|
|
|
|
{# MACRO FOR TOP MENU NAVIGATION #}
|
|
|
|
{% macro nav_loop(page) %}
|
|
{% import _self as nav_macros %}
|
|
{% for p in page.children.visible %}
|
|
{% set active_page = (p.active or p.activeChild) ? 'active' : '' %}
|
|
{% set has_visible_children = p.children.visible.count > 0 %}
|
|
<li>
|
|
<a href="{{ p.url }}" class="{{ active_page }}">
|
|
{% if p.header.icon %}
|
|
<i class="fa fa-{{ p.header.icon }}"></i>
|
|
{% endif %}
|
|
{{ p.menu }}
|
|
{% if has_visible_children %} <i class="fa fa-angle-down"></i>{% endif %}
|
|
</a>
|
|
{% if has_visible_children %}
|
|
<ul>
|
|
{{ nav_macros.nav_loop(p) }}
|
|
</ul>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
{% endmacro %} |