-
Notifications
You must be signed in to change notification settings - Fork 20
/
site_nav.html
70 lines (68 loc) · 2.95 KB
/
site_nav.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{%- comment -%}
Include as: {%- include components/site_nav.html all=bool -%}
Depends on: site.
Results in: cached HTML for the main navigation when `all` is nil or false;
includes links to pages excluded from the main navigation when `all` is true.
Includes:
components/nav/pages.html
Overwrites:
pages_top_size, collections_size, collection_entry,
collection_key, collection_value, collection.
{%- endcomment -%}
<nav aria-label="Main" id="site-nav" class="site-nav">
{% assign pages_top_size = site.html_pages
| where_exp:"item", "item.title != nil"
| where_exp:"item", "item.parent == nil"
| where_exp:"item", "item.nav_exclude != true"
| size %}
{% if pages_top_size > 0 %}
{% include components/nav/pages.html pages=site.html_pages all=include.all %}
{% endif %}
{%- if site.nav_external_links -%}
<ul class="nav-list">
{%- for node in site.nav_external_links -%}
<li class="nav-list-item external">
<a href="{{ node.url | absolute_url }}" class="nav-list-link external"
{% if node.opens_in_new_tab or node.opens_in_new_tab == nil and site.nav_external_links_new_tab %}
target="_blank" rel="noopener noreferrer"
{% endif %}
>
{{ node.title }}
{% unless node.hide_icon %}<svg viewBox="0 0 24 24" aria-labelledby="svg-external-link-title"><use xlink:href="#svg-external-link"></use></svg>{% endunless %}
</a>
</li>
{%- endfor -%}
</ul>
{%- endif -%}
{% if site.just_the_docs.collections %}
{% assign collections_size = site.just_the_docs.collections | size %}
{% for collection_entry in site.just_the_docs.collections %}
{% assign collection_key = collection_entry[0] %}
{% assign collection_value = collection_entry[1] %}
{% assign collection = site[collection_key] %}
{% if collection_value.nav_exclude != true %}
{% if collections_size > 1 or pages_top_size > 0 %}
{% if collection_value.nav_fold == true %}
<ul class="nav-list nav-category-list">
<li class="nav-list-item">
{%- if collection.size > 0 -%}
<a href="#" class="nav-list-expander"><svg viewBox="0 0 24 24"><use xlink:href="#svg-arrow-right"></use></svg></a>
{%- endif -%}
<div class="nav-category">{{ collection_value.name }}</div>
{% include components/nav/pages.html pages=collection all=include.all %}
</li>
</ul>
{% else %}
<div class="nav-category">{{ collection_value.name }}</div>
{% include components/nav/pages.html pages=collection all=include.all %}
{% endif %}
{% else %}
{% include components/nav/pages.html pages=collection all=include.all %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</nav>
{% if site.nav_error_report %}
{{ nav_error_report }}
{%- endif %}