menu: hide expander when only hidden subpages #264

This commit is contained in:
Sören Weber 2022-06-06 21:37:14 +02:00
parent e88b9ecebb
commit f65a4b819e
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -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 }}