Files
FixIt/layouts/_partials/init/detection-version.html
T
Andreas Deininger 175cf888d5 fix: eliminate deprecation warnings with hugo version 0.156.0 (#702)
* Fix deprecation warning with latest hugo version 0.156.0

* fix: use `hugo.Data` to replace the discarded `.Site.Data`

* chore(hugo): update Hugo version requirements to 0.156.0

---------

Co-authored-by: Cell <1024@lruihao.cn>
2026-02-27 15:46:31 +08:00

28 lines
1.3 KiB
HTML

{{- $version := hugo.Store.Get "version" -}}
{{- $latest := $version -}}
{{- $devOpts := .Site.Store.Get "devOpts" -}}
{{- /* Check for updates */ -}}
{{- if $devOpts.c4u -}}
{{- $url := "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" -}}
{{- $options := dict "headers" (hugo.Store.Get "githubTokenHeader") -}}
{{- $latest = (partial "function/get-remote-json" (dict "URL" $url "OPTIONS" $options )).tag_name -}}
{{- end -}}
{{- /* FixIt theme version detection */ -}}
{{- if eq .Site hugo.Sites.Default -}}
{{- if not .Site.Params.version -}}
{{- errorf "FixIt %v\n%v\n\n" $version (T "init.configurationError") -}}
{{- else if gt "0.2.0" (strings.TrimPrefix "v" .Site.Params.version) -}}
{{- errorf "FixIt %v\n%v\n\n" $version (dict "From" .Site.Params.version "To" $version | T "init.compatibilityError") -}}
{{- end -}}
{{- if gt (len (findRE "^v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9a-f]+$" $version)) 0 -}}
{{- warnidf "warning-dev-version" "FixIt %v\n%v" $version (T "init.devVersionWarn") -}}
{{- end -}}
{{- if (gt $latest $version) | and $devOpts.c4u -}}
{{- warnf "FixIt %v (⬆️ %v)\n%v`git submodule update --remote --merge`\n\n" $version $latest (T "init.quicklyUpgrade") -}}
{{- end -}}
{{- end -}}
{{- hugo.Store.Set "latest" $latest -}}