From bbe6bc43f658a3c0efef2e0bf18966730284a324 Mon Sep 17 00:00:00 2001 From: Craig Date: Mon, 7 Jul 2025 12:46:02 -0700 Subject: [PATCH 1/2] drilldown experiment Signed-off-by: Craig --- layouts/partials/sidebar/sections.html | 40 ++++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/layouts/partials/sidebar/sections.html b/layouts/partials/sidebar/sections.html index ff7b3cb0eca..07691f41f90 100644 --- a/layouts/partials/sidebar/sections.html +++ b/layouts/partials/sidebar/sections.html @@ -5,16 +5,41 @@ - Dynamically applies current page highlighting and expanded states. - Handles external links via `Params.sidebar.goto` in `renderSingle`. - Requires `Params.sitemap` and `Params.sidebar` for filtering and behavior. - */ --}} +*/ -}} {{ define "renderChildren" }} @@ -45,7 +70,6 @@ {{- end }} {{- end }} - {{ end }} {{/* Recursive template for sidebar items */}} @@ -60,7 +84,6 @@ >
{{- if .Permalink }} - {{/* If the link is not empty, use it */}} {{- else }} - {{/* Otherwise, just expand the section */}}
- + - {{ block "left" . }} - {{ partial "sidebar/mainnav.html" . }} - {{ partial "sidebar/sections.html" . }} - {{ end }} + {{ block "left" . }} + {{ partial "sidebar/mainnav.html" . }} + {{/* only skip sections.html when we're on exactly /manuals/ */}} + {{ if ne .RelPermalink "/manuals/" }} + {{ partial "sidebar/sections.html" . }} + {{ end }} + {{ end }} diff --git a/layouts/partials/sidebar/sections.html b/layouts/partials/sidebar/sections.html index 07691f41f90..b7ad62da7fe 100644 --- a/layouts/partials/sidebar/sections.html +++ b/layouts/partials/sidebar/sections.html @@ -11,35 +11,41 @@
This section
-
    - {{- $first := .FirstSection }} - {{- if eq $first.Title "Manuals" }} - {{- if eq page $first }} - {{/* 1) On /manuals/ → grouped flat list (unchanged) */}} - {{- $sections := $first.Sections }} - {{- $ungrouped := where $sections "Params.sidebar.group" "==" nil }} - {{- range $ungrouped }}{{ template "renderSingle" . }}{{- end }} - {{- range $first.Params.sidebar.groups }} - - {{- end }} - {{- else }} - {{/* 2) Under a manual → show that manual’s entire tree */}} - {{- range $first.Sections }} - {{- if or (eq page .) (page.IsDescendant .) }} - {{ template "renderList" . }} {{- end }} {{- end }} + {{- else }} + {{/* 3) Everywhere else → normal recursive nav of FirstSection */}} + {{ template "renderChildren" $first }} {{- end }} - {{- else }} - {{/* 3) Everywhere else → normal recursive nav */}} - {{ template "renderChildren" $first }} - {{- end }} -
+ {{ define "renderChildren" }} @@ -55,17 +61,17 @@ {{- template "renderSingle" . }} {{- end }} {{- end }} - {{- range .Params.sidebar.groups }} - + {{- /* grouping, allowing multiple groups per page */}} + {{- range $group := .Params.sidebar.groups }} @@ -76,26 +82,19 @@ {{ define "renderList" }} {{ $isCurrent := eq page . }} {{ $expanded := or $isCurrent (page.IsDescendant .) }} -
  • -
    +
  • +
    {{- if .Permalink }} - {{ template "renderTitle" . }} {{- else }} -
    - -
    -