diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 9f390794d..cf7a11e5c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -129,6 +129,17 @@ true ); + // open all parents items of selected page + document.querySelectorAll('a.active').forEach(function(child){ + while(!child.classList.contains("tree")){ + if (child.tagName=="DETAILS"){ + child.open=true + } + child=child.parentElement; + } + }); + + {{end}} {{if $.Site.Data.config.enableLinkPreview}} diff --git a/layouts/partials/menu-hugo.html b/layouts/partials/menu-hugo.html index 99166e721..b15d1266b 100644 --- a/layouts/partials/menu-hugo.html +++ b/layouts/partials/menu-hugo.html @@ -17,7 +17,7 @@ {{ range (where .Section.Pages "Params.bookhidden" "ne" true) }} {{ if .IsSection }} -
+
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }} @@ -35,16 +35,7 @@ {{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} {{ $current := eq .CurrentPage .Page }} {{ $ancestor := .Page.IsAncestor .CurrentPage }} - - {{ if .Page.Params.bookCollapseSection }} - - - - {{ else if .Page.Content }} + {{if .Page.Content }} {{- partial "title" .Page -}}