2024-09-07 22:12:10 +00:00
|
|
|
{{- $next := "" }}
|
|
|
|
{{- if eq .Page.Kind "term" }}
|
|
|
|
{{- /* go to next term page */}}
|
|
|
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
|
|
|
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" $taxonomy_page $taxonomy_page.Path }}
|
|
|
|
{{- $next = partial "inline/next-term" (dict "collection" $pages "item" .) }}
|
|
|
|
{{- else if eq .Page.Kind "taxonomy" }}
|
|
|
|
{{- /* go to first term page */}}
|
|
|
|
{{- $pages := partialCached "partials/_relearn/pagesTaxonomy.gotmpl" . .Path }}
|
2024-09-20 19:31:40 +00:00
|
|
|
{{- with index $pages 0 }}
|
|
|
|
{{- $next = .Page }}
|
|
|
|
{{- end }}
|
2024-09-07 22:12:10 +00:00
|
|
|
{{- else }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- $next = partial "inline/next-page" . }}
|
2023-12-01 00:03:51 +00:00
|
|
|
{{- end }}
|
2024-09-07 22:12:10 +00:00
|
|
|
{{- return $next }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/next-term" }}
|
|
|
|
{{- $collection := .collection }}
|
|
|
|
{{- $item := .item }}
|
|
|
|
{{- $found := false }}
|
|
|
|
{{- $result := "" }}
|
|
|
|
{{- range $collection }}
|
|
|
|
{{- if $found }}
|
|
|
|
{{- $result = .Page.Page }}
|
|
|
|
{{- break }}
|
|
|
|
{{- else if eq $item .Page.Page }}
|
|
|
|
{{- $found = true }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $result }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/next-page" }}
|
|
|
|
{{- $nextVisible := "" }}
|
|
|
|
{{- $currentNode := . }}
|
|
|
|
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $currentNode) $currentNode.Path }}
|
|
|
|
{{- range $pages }}
|
|
|
|
{{- $nextVisible = partial "inline/leftmost_descendant" . }}
|
|
|
|
{{- if $nextVisible }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if not $nextVisible }}
|
|
|
|
{{- $nextVisible = partial "inline/next_sibling_or_ancestor" $currentNode }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $nextVisible }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/next_sibling_or_ancestor" }}
|
|
|
|
{{- $currentNode := . }}
|
|
|
|
{{- $nextSibling := "" }}
|
|
|
|
{{- with partial "inline/parent" $currentNode }}
|
|
|
|
{{- $parent := . }}
|
|
|
|
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }}
|
|
|
|
{{- $nextVisible := partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $currentNode) }}
|
2024-09-14 22:02:38 +00:00
|
|
|
{{- range $pages }}
|
|
|
|
{{- if not $nextVisible }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
|
2024-09-14 22:02:38 +00:00
|
|
|
{{- if $nextSibling }}
|
|
|
|
{{- break }}
|
|
|
|
{{- else }}
|
|
|
|
{{- $nextVisible = partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $nextVisible) }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if not $nextSibling }}
|
|
|
|
{{- if $nextVisible }}
|
|
|
|
{{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }}
|
|
|
|
{{- end }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- if not $nextSibling }}
|
|
|
|
{{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $nextSibling }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/next_sibling" }}
|
|
|
|
{{- $siblings := .siblings }}
|
|
|
|
{{- $currentNode := .currentNode }}
|
|
|
|
{{- $nextSibling := "" }}
|
|
|
|
{{- $currentFound := false }}
|
|
|
|
{{- range $siblings }}
|
|
|
|
{{- if eq . $currentNode }}
|
|
|
|
{{- $currentFound = true }}
|
2024-10-24 21:34:37 +00:00
|
|
|
{{- else if and $currentFound (not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef)) }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- $nextSibling = . }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $nextSibling }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/leftmost_descendant" }}
|
|
|
|
{{- $leftmostVisible := "" }}
|
2024-10-24 21:34:37 +00:00
|
|
|
{{- if not (or (eq .Title "") .Params.hidden .Params.menuUrl .Params.menuPageRef) }}
|
2024-09-11 08:12:14 +00:00
|
|
|
{{- if .RelPermalink }}
|
|
|
|
{{- $leftmostVisible = . }}
|
|
|
|
{{- else }}
|
|
|
|
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
|
|
|
{{- range $pages }}
|
|
|
|
{{- with partial "inline/leftmost_descendant" . }}
|
|
|
|
{{- $leftmostVisible = . }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $leftmostVisible }}
|
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{- define "partials/inline/parent" }}
|
|
|
|
{{- $nonheadless := "" }}
|
|
|
|
{{- $page := . }}
|
|
|
|
{{- $parent := .Parent }}
|
|
|
|
{{- if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
|
|
|
|
{{- with $parent }}
|
|
|
|
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
|
|
|
{{- range $pages }}
|
|
|
|
{{- if eq . $page }}
|
|
|
|
{{- $nonheadless = $parent }}
|
|
|
|
{{- break }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- else }}
|
|
|
|
{{- $nonheadless = $parent }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- return $nonheadless }}
|
2024-09-07 22:12:10 +00:00
|
|
|
{{- end }}
|