olddocs/_includes/components/site_nav.html (86 lines of code) (raw):

{%- comment -%} Include as: {%- include_cached 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 %} > {% if node.fa_icon_key %}<i class="{{ node.fa_icon_key }} fa-fw"></i>{% 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 -%} <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/pages.html pages=collection all=include.all %} {%- if collection_value.nav_external_links -%} <ul class="nav-list"> {%- for node in collection_value.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 %} > {% if node.fa_icon_key %}<i class="{{ node.fa_icon_key }} fa-fw"></i>{% 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 -%} </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 %}