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

31 lines
1.3 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 }}
{{- $startarrow := "🡐" }}
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
{{- $startarrow = "🡒" }}
{{- end }}
{{- $prev := "" }}
{{- if and (eq .RelPermalink .Site.Home.RelPermalink) (eq $outputFormat "html") }}
{{- else if or (ne $outputFormat "html") (not (.Scratch.Get "relearnPrevPage")) (eq .Page.Kind "taxonomy") (eq .Page.Kind "term") }}
2023-09-18 18:24:49 +00:00
{{- $prev = .Site.Home }}
{{- else }}
{{- $prev = .Scratch.Get "relearnPrevPage" }}
{{- 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
"title" (printf "%s (%s)" ($prev | default .).Title ($startarrow | safeHTML))
)}}
{{- end }}
{{- end }}