mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
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:
parent
4ca21ef1bb
commit
dd7e308a4d
2 changed files with 12 additions and 8 deletions
|
@ -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 }}
|
||||
|
|
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue