From 6917823233c48130b9f11eb195f7b63dc705b996 Mon Sep 17 00:00:00 2001 From: anopsy Date: Mon, 17 Feb 2025 13:27:20 +0100 Subject: [PATCH] recursive search for levels, allowing children and subs --- _includes/components/children_nav.html | 82 ++++++++++++-------------- _includes/nav.html | 76 ++++++++---------------- 2 files changed, 61 insertions(+), 97 deletions(-) diff --git a/_includes/components/children_nav.html b/_includes/components/children_nav.html index 63eb6e66..e209c7b1 100644 --- a/_includes/components/children_nav.html +++ b/_includes/components/children_nav.html @@ -1,71 +1,42 @@ {%- comment -%} - 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 -%} - -{%- 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.) + Recursive children navigation. Works with both `subcategories` and `children`. {%- 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 -%} - + {%- endcapture -%} - {%- capture nav_list_simple -%} -