diff --git a/layouts/partials/body.print.html b/layouts/partials/body.print.html index 2bb4228d0b..9f1637fb96 100644 --- a/layouts/partials/body.print.html +++ b/layouts/partials/body.print.html @@ -28,8 +28,8 @@ {{- $isActive := .isActive }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- with .sect }} - {{- $currentIsActive := eq .RelPermalink $currentFileRelPermalink }} - {{- $isActive = or $currentIsActive $isActive }} + {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} + {{- $isActive = or $isSelf $isActive }} {{- $pages := .Pages }} {{- if .Page.IsHome }} {{- $pages = .Sections }} @@ -37,7 +37,8 @@ {{- $pages = (.Pages | union .Sections) }} {{- end }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} - {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} + {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} + {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} {{- else if or .IsSection .IsHome }} {{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 71680d5bfa..093f6e36f9 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -116,7 +116,9 @@ {{- $alwaysopen := .alwaysopen }} {{- $currentFileRelPermalink := .currentnode.RelPermalink }} {{- with .sect }} - {{- $isActive := eq .RelPermalink $currentFileRelPermalink }} + {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }} + {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }} + {{- $isActive := $isSelf }} {{- $pages := .Pages }} {{- if .Page.IsHome }} {{- $pages = .Sections }} @@ -124,13 +126,13 @@ {{- $pages = (.Pages | union .Sections) }} {{- end }} {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} - {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} + {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- if $hidden }} {{- else if or .IsSection .IsHome }} {{- $numberOfVisibleChildren := 0 }} {{- range $pages }} {{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} - {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }} + {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} {{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }} {{- end }} {{- safeHTML .Params.head }} @@ -139,8 +141,8 @@ {{- $currentOrdersectionsby := .Params.ordersectionsby | default $defaultOrdersectionsby }} {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $pageHash := md5 .Page }} - {{- $isOpen := or $currentAlwaysopen (.IsAncestor $currentNode) }} -
  • + {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }} +
  • {{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }} {{- if $showvisitedlinks }}{{ end }}