-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathsidenav.html
38 lines (37 loc) · 1.4 KB
/
sidenav.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
{% comment %}
The sidenav is not loaded by default on the main pages. To include this navigation you can either use the
_layouts/page.html layout template, or you can add "sidenav: true" in the front-matter of your pages
{% endcomment %}
<aside class="usa-layout-docs-sidenav desktop:grid-col-3 padding-bottom-4">
<nav class="{% if sticky_sidenav %} position-sticky top-1 {% endif%} ">
<ul class="usa-sidenav">
{% if eleventyNavigation.parent %}
{% assign links = collections.all | eleventyNavigation: eleventyNavigation.parent %}
{% else %}
{% assign links = collections[eleventyNavigation.key] | eleventyNavigation %}
{% endif %}
{% for link in links %}
{% assign _current = false %}
{% if link.url == page.url %}
{% assign _current = true %}
{% endif %}
<li class="usa-sidenav__item">
<a href="{{ link.url | url }}"
{% if _current %} class="usa-current" {% endif %}
>
{{ link.title }}
</a>
{% if subnav and _current %}
{% for heading in subnav %}
<ul class="usa-sidenav__sublist">
<li class="usa-sidenav__item border-0">
<a href="{{ heading.href }}"> {{ heading.text }} </a>
</li>
</ul>
{% endfor %}
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
</aside>