menu - hidden sibling pages are sometimes not visible #152

put every meta data of a page into the its corresponding scratch
This commit is contained in:
Sören Weber 2021-11-15 23:41:51 +01:00
parent 4ca21ef1bb
commit dd7e308a4d
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 12 additions and 8 deletions

View file

@ -106,7 +106,8 @@
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
{{- $alwaysopen := .alwaysopen }}
{{- with .sect }}
{{- $hidden := and (eq (.Scratch.Get "relearnIsHiddenFromCurrent") true) (not $.showhidden) (not (.IsAncestor $currentNode)) }}
{{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
{{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not (.IsAncestor $currentNode)) }}
{{- if $hidden }}
{{- else if .IsSection }}
{{- safeHTML .Params.head }}

View file

@ -1,8 +1,11 @@
{{- $currentNode := . }}
{{- $currentNode.Scratch.Set "relearnIsSelfFound" nil }}
{{- $currentNode.Scratch.Set "relearnPrevPage" nil }}
{{- $currentNode.Scratch.Set "relearnNextPage" nil }}
{{- $currentNode.Scratch.Set "relearnSubPages" nil }}
{{- $currentNode.Scratch.Delete "relearnIsSelfFound" }}
{{- $currentNode.Scratch.Delete "relearnPrevPage" }}
{{- $currentNode.Scratch.Delete "relearnNextPage" }}
{{- $currentNode.Scratch.Delete "relearnSubPages" }}
{{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}
{{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}
{{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false }}
{{- define "relearn-structure" }}
{{- $currentNode := .currentnode }}
@ -22,9 +25,9 @@
{{- $hidden_stem:= or $hidden_node .hiddenstem }}
{{- $hidden_current_stem:= or $hidden_node .hiddencurrent }}
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hiddencurrent (or $isPreSelf $isPostSelf $isDescendant) ) }}
{{- .node.Scratch.Set "relearnIsHiddenNode" $hidden_node}}
{{- .node.Scratch.Set "relearnIsHiddenStem" $hidden_stem}}
{{- .node.Scratch.Set "relearnIsHiddenFromCurrent" $hidden_current_stem}}
{{- $currentNode.Scratch.Set "relearnIsHiddenNode" (merge ($currentNode.Scratch.Get "relearnIsHiddenNode") (dict .node.RelPermalink $hidden_node) ) }}
{{- $currentNode.Scratch.Set "relearnIsHiddenStem" (merge ($currentNode.Scratch.Get "relearnIsHiddenStem") (dict .node.RelPermalink $hidden_stem) ) }}
{{- $currentNode.Scratch.Set "relearnIsHiddenFrom" (merge ($currentNode.Scratch.Get "relearnIsHiddenFrom") (dict .node.RelPermalink $hidden_current_stem) ) }}
{{- if not $hidden_from_current }}
{{- if $isPreSelf }}