Files
FixIt/layouts/partials/init.html
T
2022-05-21 12:31:47 +08:00

65 lines
2.5 KiB
HTML

{{- $version := "v0.2.15-RC" -}}
{{- $VERSION := "0.2.X" -}}
{{- /* FixIt theme version detection */ -}}
{{- if eq .Site .Sites.First -}}
{{- if (strings.HasSuffix $version "RC") -}}
{{- warnf "FixIt %v\n%v" $version (T "RCVersionWarn") -}}
{{- end -}}
{{- if not .Site.Params.version -}}
{{- errorf "FixIt %v\n%v" $version (T "configurationError") -}}
{{- else if ne .Site.Params.version $VERSION -}}
{{- errorf "FixIt %v\n%v" $version (dict "From" .Site.Params.version "To" $VERSION | T "compatibilityError") -}}
{{- end -}}
{{- end -}}
{{- $params := .Params | merge .Site.Params.page -}}
{{- $toc := $params.toc -}}
{{- if eq $toc true -}}
{{- $toc = .Site.Params.page.toc | default dict -}}
{{- else if eq $toc false -}}
{{- $toc = dict "enable" false -}}
{{- end -}}
{{- if hugo.IsProduction -}}
{{- $cdn := .Site.Params.cdn -}}
{{- with $cdn.data -}}
{{- $cdnData := printf "data/cdn/%v" . | resources.Get | transform.Unmarshal -}}
{{- $cdn = dict "simpleIconsPrefix" $cdnData.prefix.simpleIcons -}}
{{- $prefix := $cdnData.prefix.libFiles | default "" -}}
{{- range $key, $value := $cdnData.libFiles -}}
{{- $cdn = printf "%v%v" $prefix $value | dict $key | merge $cdn -}}
{{- end -}}
{{- end -}}
{{- .Scratch.Set "cdn" $cdn -}}
{{- .Scratch.Set "fingerprint" .Site.Params.fingerprint -}}
{{- .Scratch.Set "analytics" .Site.Params.analytics -}}
{{- .Scratch.Set "comment" $params.comment -}}
{{- if eq .Params.comment true -}}
{{- .Scratch.Set "comment" .Site.Params.page.comment -}}
{{- else if eq .Params.comment false -}}
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- else if eq .Site .Sites.First -}}
{{- warnf "FixIt %v\n%v" $version (T "devEnvWarn") -}}
{{- end -}}
{{- /* Deprecated parameter detection */ -}}
{{- $warnErrors := slice -}}
{{- with .Site.Params.home.profile.gravatarSite -}}
{{- $warnErrors = $warnErrors | append "The parameter `home.profile.gravatarSite` is deprecated since v0.2.14, use `gravatar.host` instead." -}}
{{- end -}}
{{- with .Site.Params.ibruce.siteTime -}}
{{- $warnErrors = $warnErrors | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
{{- end -}}
{{- if len $warnErrors -}}
{{- warnf "Deprecated parameter detection until %v\n - %v" $version (delimit $warnErrors "\n - ") -}}
{{- end -}}
{{- .Scratch.Set "version" $version -}}
{{- .Scratch.Set "params" $params -}}
{{- .Scratch.Set "toc" $toc -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "plugin/compatibility.html" . -}}