hugo-theme-relearn/layouts/partials/topbar/button/next.html

49 lines
2.4 KiB
HTML
Raw Normal View History

2023-09-18 18:24:49 +00:00
{{- $onwidths := cond (isset . "onwidths") .onwidths "show" }}
{{- $onwidthm := cond (isset . "onwidthm") .onwidthm "show" }}
{{- $onwidthl := cond (isset . "onwidthl") .onwidthl "show" }}
{{- with .page }}
{{- $format := partial "get-format.hugo" . }}
{{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
{{- $endarrow := "🡒" }}
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
2023-09-18 18:24:49 +00:00
{{- $endarrow = "🡐" }}
{{- end }}
{{- $next := "" }}
{{- $nextTitle := .Title }}
{{- if eq .Page.Kind "taxonomy" }}
{{- /* go to first term page */}}
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" . . }}
2023-12-01 20:36:58 +00:00
{{- $next = (index $pages 0).Page }}
{{- if $next }}
{{- $taxonomy_page := .Page }}
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
{{- end }}
{{- else if eq .Page.Kind "term" }}
{{- /* go to next term page */}}
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
{{- $next = partial "partials/pageHelper/next.html" (dict "collection" $pages "item" .) }}
{{- if $next }}
{{- $nextTitle = default (default $next.Data.Singular (i18n $next.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
{{- $nextTitle = printf "%s %s %s" $nextTitle (default "::" $next.Site.Params.titleSeparator) (default (humanize $next.Data.Term | strings.Title) $next.Title) }}
{{- end }}
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnNextPage")) }}
2023-09-18 18:24:49 +00:00
{{- else }}
{{- $next = .Scratch.Get "relearnNextPage" }}
{{- $nextTitle = $next.Title }}
2023-09-18 18:24:49 +00:00
{{- end }}
{{- partial "topbar/func/button.html" (dict
"page" .
"class" "topbar-button-next"
"href" (partial "relLangPrettyUglyURL.hugo" (dict "to" $next))
"icon" "chevron-right"
"onwidths" $onwidths
"onwidthm" $onwidthm
"onwidthl" $onwidthl
"hint" (printf "%s (%s)" $nextTitle ($endarrow | safeHTML))
2023-09-18 18:24:49 +00:00
)}}
{{- end }}
{{- end }}