32 lines
851 B
Plaintext
32 lines
851 B
Plaintext
{% set navPages = collections.all | eleventyNavigation %}
|
|
|
|
{% macro renderNavListItem(entry) %}
|
|
{% if entry.children.length %}
|
|
<li>
|
|
<details
|
|
{%- for child in entry.children %}
|
|
{% if child.url == page.url %}
|
|
class="is-active"
|
|
open
|
|
{% endif %}
|
|
{% endfor %}
|
|
>
|
|
<summary>{{ entry.title }}</summary>
|
|
<ul role="list">
|
|
{%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}
|
|
</ul>
|
|
</details>
|
|
</li>
|
|
{% else %}
|
|
<li>
|
|
<a href="{{ entry.url }}"
|
|
{% if entry.url == page.url %}aria-current="page" {% endif %}>
|
|
{{ entry.title }}
|
|
</a>
|
|
</li>
|
|
{%- endif -%}
|
|
{%- endmacro %}
|
|
|
|
<ul class="nav-list" role="list">
|
|
{%- for entry in navPages %}{{ renderNavListItem(entry) }}{%- endfor -%}
|
|
</ul> |