mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-30 11:13:06 +00:00
49 lines
No EOL
2.3 KiB
HTML
49 lines
No EOL
2.3 KiB
HTML
{{- $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 }}
|
|
{{- $startarrow := "🡐" }}
|
|
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
|
{{- $startarrow = "🡒" }}
|
|
{{- end }}
|
|
{{- $prev := "" }}
|
|
{{- $prevTitle := .Title }}
|
|
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
|
|
{{- else if eq .Page.Kind "taxonomy" }}
|
|
{{- $prev = .Site.Home }}
|
|
{{- $prevTitle = $prev.Title }}
|
|
{{- else if eq .Page.Kind "term" }}
|
|
{{- /* go to previous term page or taxonomy page if it is the first term */}}
|
|
{{- $taxonomy_page := .Site.GetPage .Data.Plural }}
|
|
{{- $pages := partialCached "partials/pageHelper/taxonomyPages.html" $taxonomy_page $taxonomy_page }}
|
|
{{- $prev = partial "partials/pageHelper/prev.html" (dict "collection" $pages "item" .) }}
|
|
{{- if not $prev }}
|
|
{{- $prev = $taxonomy_page }}
|
|
{{- $prevTitle = default (default $prev.Data.Plural (i18n $prev.Data.Plural)) $prev.Params.Title }}
|
|
{{- else }}
|
|
{{- $prevTitle = default (default $prev.Data.Singular (i18n $prev.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
|
{{- $prevTitle = printf "%s %s %s" $prevTitle (default "::" $prev.Site.Params.titleSeparator) (default (humanize $prev.Data.Term | strings.Title) $prev.Title) }}
|
|
{{- end }}
|
|
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) }}
|
|
{{- $prev = .Site.Home }}
|
|
{{- $prevTitle = $prev.Title }}
|
|
{{- else }}
|
|
{{- $prev = .Scratch.Get "relearnPrevPage" }}
|
|
{{- $prevTitle = $prev.Title }}
|
|
{{- end}}
|
|
{{- partial "topbar/func/button.html" (dict
|
|
"page" .
|
|
"class" "topbar-button-prev"
|
|
"href" (partial "relLangPrettyUglyURL.hugo" (dict "to" $prev))
|
|
"icon" "chevron-left"
|
|
"onwidths" $onwidths
|
|
"onwidthm" $onwidthm
|
|
"onwidthl" $onwidthl
|
|
"hint" (printf "%s (%s)" $prevTitle ($startarrow | safeHTML))
|
|
)}}
|
|
{{- end }}
|
|
{{- end }} |