mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-03-20 16:15:09 +00:00
35 lines
No EOL
1.3 KiB
HTML
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 }} |