mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-23 11:32:22 -06:00
* Refactor nav, breadcrumbs, children_nav Fix #1118 Improve the modularity of building the nav-panel, breadcrumbs, and children-nav by making them independent. This also significantly simplifies the Liquid code. * Fix order of breadcrumbs * Update breadcrumbs.html Revert inclusion of single breadcrumb for top-level pages. * Update breadcrumbs.html * Update children_nav.html Revert to the previous layout in the HTML, to allow the use of `diff` to check the built site. * Update minimal.html Remove the previously required workaround involving `nav.html`. * Add docs pages about layouts The aim of the initial version of these docs pages is to illustrate the difference between the default and minimal layouts. * Update CHANGELOG.md
44 lines
1.4 KiB
HTML
44 lines
1.4 KiB
HTML
{%- comment -%}
|
|
Include as: {%- include components/breadcrumbs.html -%}
|
|
Depends on: page, site.
|
|
Results in: HTML for the breadcrumbs component.
|
|
Overwrites:
|
|
pages_list, parent_page, grandparent_page.
|
|
{%- endcomment -%}
|
|
|
|
{%- if page.url != "/" and page.parent -%}
|
|
|
|
{%- assign pages_list = site[page.collection]
|
|
| default: site.html_pages
|
|
| where_exp: "item", "item.title != nil"
|
|
| where_exp: "item", "item.has_children != nil" -%}
|
|
|
|
{%- if page.grand_parent -%}
|
|
{%- assign parent_page = pages_list
|
|
| where: "title", page.parent
|
|
| where: "parent", page.grand_parent
|
|
| first -%}
|
|
{%- assign grandparent_page = pages_list
|
|
| where: "title", page.grand_parent
|
|
| first -%}
|
|
{%- else -%}
|
|
{%- assign parent_page = pages_list
|
|
| where: "title", page.parent
|
|
| where_exp: "item", "item.parent == nil"
|
|
| first -%}
|
|
{%- endif -%}
|
|
|
|
<nav aria-label="Breadcrumb" class="breadcrumb-nav">
|
|
<ol class="breadcrumb-nav-list">
|
|
{% if page.parent -%}
|
|
{%- if page.grand_parent %}
|
|
<li class="breadcrumb-nav-list-item"><a href="{{ grandparent_page.url | relative_url }}">{{ page.grand_parent }}</a></li>
|
|
{%- endif %}
|
|
<li class="breadcrumb-nav-list-item"><a href="{{ parent_page.url | relative_url }}">{{ page.parent }}</a></li>
|
|
{% endif -%}
|
|
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
|
|
</ol>
|
|
</nav>
|
|
|
|
{%- endif -%}
|