mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-04-30 11:29:05 +08:00
38 lines
1.4 KiB
HTML
38 lines
1.4 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)
|
|
}}
|
|
{{- $path := partial "_relearn/pageLangPath.gotmpl" . }}
|
|
{{- $url := print $latestVersion.baseURL $path }}
|
|
{{- warnf "a %s" $url}}
|
|
{{- if not $latestVersion.isAbs }}
|
|
{{- $url = print (partial "_relearn/relBaseUri.gotmpl" .) $url }}
|
|
{{- warnf "b %s" $url}}
|
|
{{- end }}
|
|
{{- partial "shortcodes/notice.html" (dict
|
|
"page" .
|
|
"content" (T "Version-warning" (dict "version" $pageVersion.title "latestUrl" $url ))
|
|
"icon" " "
|
|
"style" "warning"
|
|
"title" " "
|
|
) }}
|
|
{{- end }} |