hugo-theme-relearn/layouts/partials/content-lead.html
Sören Weber 5ba09afb6c
Some checks are pending
docs-build-deployment / Run deploy (push) Waiting to run
docs-build / Run build (push) Waiting to run
theme: add version selector #1050
2025-03-17 23:13:43 +01:00

35 lines
No EOL
1.3 KiB
HTML

{{- $versions := partialCached "_relearn/siteVersions.gotmpl" . }}
{{- $pageVersion := site.Params.version | default "" }}
{{- if and $versions (not $pageVersion) }}
{{- warnf "WARNING you have configured `versions` but did not mark this site with a `version`; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/7/#7-6-0" }}
{{- end }}
{{- $latestVersion := "" }}
{{- with (where $versions "isLatest" true | first 1) }}
{{- range . }}
{{- $latestVersion = . }}
{{- end }}
{{- end }}
{{- with (where $versions "identifier" $pageVersion | first 1) }}
{{- range . }}
{{- $pageVersion = . }}
{{- end }}
{{- end }}
{{- if and
(not (site.Params.disableVersionWarning | default .Params.disableVersionWarning))
(eq (.Store.Get "relearnOutputFormat") "html")
$pageVersion
$latestVersion
(ne $pageVersion.identifier $latestVersion.identifier)
}}
{{- $url := print $latestVersion.baseURL (partial "permalink.gotmpl" (dict "to" .)) }}
{{- if not $latestVersion.isAbs }}
{{- $url = print (partial "_relearn/relBaseUri.gotmpl" .) $url }}
{{- end }}
{{- partial "shortcodes/notice.html" (dict
"page" .
"content" (T "Version-warning" (dict "version" $pageVersion.title "latestUrl" $url ))
"icon" " "
"style" "warning"
"title" " "
) }}
{{- end }}