mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
30 lines
No EOL
996 B
Go Template
30 lines
No EOL
996 B
Go Template
{{- $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 }}
|
|
{{- $next = (index $pages 0).Page }}
|
|
{{- else }}
|
|
{{- $next = .Scratch.Get "relearnNextPage" }}
|
|
{{- end }}
|
|
{{- 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 }}
|
|
{{- end }} |