From f65a4b819e4603e93b6e7e1a759b199fdfcb5ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 6 Jun 2022 21:37:14 +0200 Subject: [PATCH] menu: hide expander when only hidden subpages #264 --- layouts/partials/menu.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 093f6e36f9..d5a18b7b9d 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -131,8 +131,10 @@ {{- else if or .IsSection .IsHome }} {{- $numberOfVisibleChildren := 0 }} {{- range $pages }} + {{- $isSelfSub := eq .RelPermalink $currentFileRelPermalink }} + {{- $isAncestorSub := and (not $isSelf) (.IsAncestor $currentNode) }} {{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} - {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }} + {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelfSub) (not $isAncestorSub) }} {{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }} {{- end }} {{- safeHTML .Params.head }}