-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removing unsupported macro from nav.html
- Loading branch information
Showing
2 changed files
with
45 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,68 @@ | ||
{%- comment -%} | ||
Updated to support both `children` and `subcategories` for flexible YAML structures. | ||
Include as: {%- include components/children_nav.html -%} | ||
Depends on: page, site, nav_breadcrumbs. | ||
Results in: HTML for the children-navigation component. | ||
Includes: components/nav/sorted.html, toc_heading_custom.html. | ||
Overwrites: | ||
nav_ancestor_links, nav_top_node_titles, nav_child_candidates, nav_children, | ||
nav_child, nav_child_ok, nav_child_ancestor, nav_sorted. | ||
{%- endcomment -%} | ||
|
||
{%- if page.has_children == false and page.subcategories == nil -%} | ||
{%- comment -%} | ||
Whether a page has any children is checked efficiently by inspecting the cached | ||
site_nav. If the page has no children, nav_children is set to an empty array; | ||
otherwise nav_children is left unset. (The site_nav is rendered the first time | ||
it is included, and that may overwrite various variables.) | ||
{%- endcomment -%} | ||
{%- if page.has_children == false -%} | ||
{%- assign nav_children = "" | split: "" -%} | ||
{%- else -%} | ||
{%- capture site_nav -%} | ||
{%- include_cached components/site_nav.html all=true -%} | ||
{%- include_cached components/site_nav.html all=true -%} | ||
{%- endcapture -%} | ||
{%- assign nav_children = nil -%} | ||
{%- capture nav_list_link -%} | ||
<a href="{{ page.url | relative_url }}" class="nav-list-link"> | ||
{%- endcapture -%} | ||
|
||
{%- assign nav_children = site_nav | where_exp: "item", "item.parent == page.url" | concat: page.subcategories -%} | ||
{%- capture nav_list_simple -%} | ||
<ul class="nav-list"> | ||
{%- endcapture -%} | ||
{%- assign nav_child_start = site_nav | ||
| split: nav_list_link | last | ||
| split: "</a>" | slice: 1 | first -%} | ||
{%- assign nav_child_test = nav_child_start | ||
| remove_first: nav_list_simple | prepend: nav_list_simple -%} | ||
{%- if nav_child_start != nav_child_test -%} | ||
{%- assign nav_children = "" | split: "" -%} | ||
{%- endif -%} | ||
{%- endif -%} | ||
|
||
{%- unless nav_children == empty -%} | ||
|
||
{%- unless nav_children -%} | ||
{%- comment -%} | ||
The layout is assumed to include components/breadcrumbs.html before this file, | ||
otherwise it needs to be included here. | ||
{%- endcomment -%} | ||
{%- assign nav_ancestors = "" | split: "" -%} | ||
{%- for nav_link in nav_breadcrumbs -%} | ||
{%- assign nav_title = nav_link | split: ">" | slice: 1 | first | append: ">" | remove: "</a>" -%} | ||
{%- assign nav_ancestors = nav_ancestors | push: nav_title -%} | ||
{%- endfor -%} | ||
|
||
{%- assign nav_parenthood = site[page.collection] | default: site.html_pages | where_exp: "item", "item.title != nil" | group_by: "parent" -%} | ||
|
||
{%- assign nav_top_nodes = nav_parenthood | where_exp: "item", "item.name == ''" | map: "items" | first -%} | ||
|
||
{%- assign nav_top_node_titles = nav_top_nodes | map: "title" -%} | ||
|
||
{%- assign nav_parenthood = site[page.collection] | default: site.html_pages | ||
| where_exp: "item", "item.title != nil" | group_by: "parent" -%} | ||
{%- assign nav_top_nodes = nav_parenthood | ||
| where_exp: "item", "item.name == ''" | map: "items" | first -%} | ||
{% assign nav_top_node_titles = nav_top_nodes | map: "title" -%} | ||
{%- include components/nav/children.html node=page ancestors=nav_ancestors all=true -%} | ||
|
||
{%- endunless -%} | ||
|
||
{%- if nav_children.size >= 1 -%} | ||
|
||
{%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%} | ||
{%- assign nav_children = nav_children | reverse -%} | ||
{%- endif -%} | ||
|
||
<hr> | ||
{% include toc_heading_custom.html %} | ||
|
||
<ul class="nav-list"> | ||
<ul> | ||
{% for nav_child in nav_children %} | ||
<li> | ||
<a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a> | ||
</li> | ||
<li> | ||
<a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a>{% if nav_child.summary %} - {{ nav_child.summary }}{% endif %} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
{%- endif -%} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters