mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
44d0c7611d
.Sites.First was deprecated in Hugo v0.127.0 and will be removed in a future release. Use .Sites.Default instead.
28 lines
1.2 KiB
HTML
28 lines
1.2 KiB
HTML
{{- $version := .Scratch.Get "version" -}}
|
|
{{- $latest := $version -}}
|
|
{{- $devOpts := .Scratch.Get "devOpts" -}}
|
|
|
|
{{- /* Check for updates */ -}}
|
|
{{- if $devOpts.c4u -}}
|
|
{{- $url := "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" -}}
|
|
{{- $options := dict "headers" (.Scratch.Get "githubTokenHeader") -}}
|
|
{{- $latest = (partial "function/get-remote-json" (dict "URL" $url "OPTIONS" $options )).tag_name -}}
|
|
{{- end -}}
|
|
|
|
{{- /* FixIt theme version detection */ -}}
|
|
{{- if eq .Site .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 (strings.HasSuffix $version "RC") | and $devOpts.c4u -}}
|
|
{{- warnf "FixIt %v\n%v\n\n" $version (T "init.RCVersionWarn") -}}
|
|
{{- 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 -}}
|
|
|
|
{{- .Scratch.Set "latest" $latest -}}
|