Skip to content

Commit

Permalink
Sync site_nav.html with JTD
Browse files Browse the repository at this point in the history
  • Loading branch information
flanakin committed Sep 1, 2024
1 parent 205859e commit 4f14c56
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions docs/_includes/components/site_nav.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{%- comment -%}
Include as: {%- include_cached components/site_nav.html -%}
Include as: {%- include_cached components/site_nav.html all=bool -%}
Depends on: site.
Results in: HTML for the site-nav.
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.html
components/nav/pages.html
Overwrites:
pages_top_size, collections_size, collection_entry,
collection_key, collection_value, collection.
Expand All @@ -23,8 +24,24 @@
</ul>

{% if pages_top_size > 0 %}
{% include components/nav.html pages=site.html_pages %}
{% 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 %}
Expand All @@ -37,20 +54,20 @@
<ul class="nav-list nav-category-list">
<li class="nav-list-item">
{%- if collection.size > 0 -%}
<button class="nav-list-expander btn-reset" aria-label="Toggle collection {{ collection_value.name }}" aria-pressed="true">
<button class="nav-list-expander btn-reset" aria-label="Toggle collection {{ collection_value.name }}" aria-pressed="false">
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
</button>
{%- endif -%}
<div class="nav-category">{{ collection_value.name }}</div>
{% include components/nav.html pages=collection %}
{% include components/nav/pages.html pages=collection all=include.all %}
</li>
</ul>
{% else %}
<div class="nav-category">{{ collection_value.name }}</div>
{% include components/nav.html pages=collection %}
{% include components/nav/pages.html pages=collection all=include.all %}
{% endif %}
{% else %}
{% include components/nav.html pages=collection %}
{% include components/nav/pages.html pages=collection all=include.all %}
{% endif %}
{% endif %}
{% endfor %}
Expand All @@ -71,4 +88,8 @@
{%- endfor -%}
</ul>
{%- endif -%}
</nav>
</nav>

{% if site.nav_error_report %}
{{ nav_error_report }}
{%- endif %}

0 comments on commit 4f14c56

Please sign in to comment.