diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 14104ba570..1cd8887d77 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -31,7 +31,7 @@ {{- $isSubHidden := or (.Params.hidden) (eq .Title "") }} {{- if or $isSubSelf $isSubAncestor }} {{- partial "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden ) }} - {{- else if not $isSubHidden }} + {{- else if and (not $isSubHidden) (or .Params.collapsibleMenu .Site.Params.collapsibleMenu (not .Parent.RelPermalink) (eq .Parent $currentNode) (.Parent.IsAncestor $currentNode)) }} {{- partialCached "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) .Path }} {{- end }} {{- end }} @@ -144,11 +144,13 @@ {{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }} {{- $url := partial "permalink.gotmpl" (dict "to" .) }} {{- if $hasVisibleChildren }} - {{- $isCollapsible := or (.Params.collapsibleMenu | default .Site.Params.collapsibleMenu) (not $url) }} + {{- $isCollapsible := or .Params.collapsibleMenu .Site.Params.collapsibleMenu }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $pageId := md5 .Page }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }} -