-
Notifications
You must be signed in to change notification settings - Fork 196
/
Copy pathdocs-nav-collapsing.html
41 lines (38 loc) · 1.42 KB
/
docs-nav-collapsing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% set navSection = eleventyNavigation.parent or eleventyNavigation.key %}
{%- set navSections = collections[collection] | eleventyNavigation -%}
{%- for section in navSections %}
{# Are any children in this section active? #}
{% set sectionActive = false %}
{%- for child in section.children %}
{% if child.url == page.url %}
{% set sectionActive = true %}
{% endif %}
{%- endfor %}
<li{% if sectionActive %} class="activeSection"{% endif %}>
{%- if section.children | length %}
<details>
<summary>
<span class="sectionHead
{% if section.url == page.url %}active{% endif %}">
{{ section.title }}
{% if section.labs == true %}
<img class="labs" src="/images/alerts/labs.svg" alt="labs" loading="lazy" fetchpriority="low" />
{% endif %}
</span>
</summary>
<ol>
{%- for child in section.children %}
<li{% if child.url == page.url %} class="active"{% endif %}>
<a href="{{ child.url | url }}">
{{ child.title }}
{% if child.labs == true or child.labs == "true" %}
<img class="labs" src="/images/alerts/labs.svg" alt="labs" loading="lazy" fetchpriority="low" />
{% endif %}
</a>
</li>
{%- endfor %}
</ol>
</details>
{%- endif %}
</li>
{%- endfor %}