2021-09-09 20:26:24 +00:00
|
|
|
{{- $currentNode := . }}
|
2023-10-11 21:58:25 +00:00
|
|
|
{{- $forceContent := $currentNode.WordCount }}
|
2021-11-15 22:41:51 +00:00
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsSelfFound" }}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnPrevPage" }}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnNextPage" }}
|
2022-04-03 10:12:12 +00:00
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenNode" }}{{/* the node itself is flagged as hidden */}}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenStem" }}{{/* the node or one of its parents is flagged as hidden */}}
|
|
|
|
{{- $currentNode.Scratch.Delete "relearnIsHiddenFrom" }}{{/* the node is hidden from the current page */}}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- range $currentNode.Site.Params.relearn.dependencies }}
|
|
|
|
{{- $has := printf "has%s" .name }}
|
|
|
|
{{- $disable := printf "disable%s" .name }}
|
2023-10-12 21:32:17 +00:00
|
|
|
{{- $wants := or (and (ne (index $currentNode.Params $disable) nil) (not (index $currentNode.Params $disable))) (and (ne (index $currentNode.Site.Params $disable) nil) (not (index $currentNode.Site.Params $disable))) }}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- if $wants }}
|
|
|
|
{{- $currentNode.Store.Set $has true }}
|
|
|
|
{{- end }}
|
2022-07-09 23:25:38 +00:00
|
|
|
{{- end }}
|
2023-10-12 21:08:58 +00:00
|
|
|
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- define "relearn-structure" }}
|
|
|
|
{{- $currentNode := .currentnode }}
|
2023-09-21 15:23:41 +00:00
|
|
|
{{- $isSelf := eq $currentNode .node }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- $isDescendant := and (not $isSelf) (.node.IsDescendant $currentNode) }}
|
|
|
|
{{- $isAncestor := and (not $isSelf) (.node.IsAncestor $currentNode) }}
|
|
|
|
{{- $isOther := and (not $isDescendant) (not $isSelf) (not $isAncestor) }}
|
2023-09-21 15:23:41 +00:00
|
|
|
{{- $isChildren := eq $currentNode .node.Parent }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- if $isSelf }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnIsSelfFound" true }}
|
|
|
|
{{- end}}
|
|
|
|
{{- $isSelfFound := eq ($currentNode.Scratch.Get "relearnIsSelfFound") true }}
|
|
|
|
{{- $isPreSelf := and (not $isSelfFound) (not $isSelf) }}
|
|
|
|
{{- $isPostSelf := and ($isSelfFound) (not $isSelf) }}
|
|
|
|
|
|
|
|
{{- $hidden_node := or (.node.Params.hidden) (eq .node.Title "") }}
|
2023-09-21 15:24:10 +00:00
|
|
|
{{- $hidden_stem := or $hidden_node .hiddenstem }}
|
|
|
|
{{- $hidden_current_stem := or $hidden_node .hiddencurrent }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- $hidden_from_current := or (and $hidden_node (not $isAncestor) (not $isSelf) ) (and .hiddencurrent (or $isPreSelf $isPostSelf $isDescendant) ) }}
|
2022-07-15 19:36:41 +00:00
|
|
|
{{- if $isSelf }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnIsHiddenNode" $hidden_node }}
|
|
|
|
{{- $currentNode.Scratch.Set "relearnIsHiddenStem" $hidden_stem }}
|
|
|
|
{{- end}}
|
2021-11-22 11:10:35 +00:00
|
|
|
{{- $currentNode.Scratch.SetInMap "relearnIsHiddenFrom" .node.RelPermalink $hidden_current_stem }}
|
2021-09-09 20:26:24 +00:00
|
|
|
|
|
|
|
{{- if not $hidden_from_current }}
|
2023-09-21 15:23:41 +00:00
|
|
|
{{- if and $isPreSelf .node.RelPermalink }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- $currentNode.Scratch.Set "relearnPrevPage" .node }}
|
2023-09-21 15:23:41 +00:00
|
|
|
{{- else if and $isPostSelf .node.RelPermalink (eq ($currentNode.Scratch.Get "relearnNextPage") nil) }}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- $currentNode.Scratch.Set "relearnNextPage" .node }}
|
|
|
|
{{- end}}
|
|
|
|
{{- end }}
|
|
|
|
|
2023-10-12 21:08:58 +00:00
|
|
|
{{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .node "hidden" true) }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- range $pages }}
|
2023-10-12 21:08:58 +00:00
|
|
|
{{- template "relearn-structure" dict "node" . "currentnode" $currentNode "hiddenstem" $hidden_stem "hiddencurrent" $hidden_from_current }}
|
2022-07-09 14:38:28 +00:00
|
|
|
{{- end}}
|
2021-09-09 20:26:24 +00:00
|
|
|
{{- end }}
|