redesign 2023
This commit is contained in:
26
themes/FixIt/layouts/partials/init/detection-deprecated.html
Normal file
26
themes/FixIt/layouts/partials/init/detection-deprecated.html
Normal file
@ -0,0 +1,26 @@
|
||||
{{- /* Deprecated parameter detection */ -}}
|
||||
{{- $warns := slice -}}
|
||||
{{- $errors := slice -}}
|
||||
|
||||
{{- with .Site.Params.home.profile.gravatarSite -}}
|
||||
{{- $warns = $warns | append "The parameter `home.profile.gravatarSite` is deprecated since v0.2.14, use `gravatar.host` instead." -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.ibruce.siteTime -}}
|
||||
{{- $warns = $warns | append "The parameter `ibruce.siteTime` is deprecated since v0.2.14, use `footer.siteTime` instead." -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.autoBookmark -}}
|
||||
{{- $warns = $warns | append "The parameter `autoBookmark` is deprecated since v0.2.17, use `page.autoBookmark` instead." -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.footer.siteTime -}}
|
||||
{{- if not (reflect.IsMap .) -}}
|
||||
{{- $warns = $warns | append "The parameter `footer.siteTime` has changed to a Map since v0.2.17. Please correct the format!" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $warns -}}
|
||||
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $errors -}}
|
||||
{{- errorf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $errors "\n - ") -}}
|
||||
{{- end -}}
|
32
themes/FixIt/layouts/partials/init/detection-env.html
Normal file
32
themes/FixIt/layouts/partials/init/detection-env.html
Normal file
@ -0,0 +1,32 @@
|
||||
{{- /* FixIt theme environment detection */ -}}
|
||||
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- 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 "enable" false) -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- .Scratch.Set "devOpts" .Site.Params.dev -}}
|
||||
{{- if ne .Site.Params.dev.enable true -}}
|
||||
{{- .Scratch.Set "devOpts" dict -}}
|
||||
{{- end -}}
|
||||
{{- if eq .Site .Sites.First -}}
|
||||
{{- warnf "FixIt %v\n%v\n\n" (.Scratch.Get "version") (T "init.devEnvWarn") -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
30
themes/FixIt/layouts/partials/init/detection-version.html
Normal file
30
themes/FixIt/layouts/partials/init/detection-version.html
Normal file
@ -0,0 +1,30 @@
|
||||
{{- $version := .Scratch.Get "version" -}}
|
||||
{{- $latest := $version -}}
|
||||
{{- $devOpts := .Scratch.Get "devOpts" -}}
|
||||
|
||||
{{- /* Check for updates */ -}}
|
||||
{{- if $devOpts.c4u -}}
|
||||
{{- /* Select the scope named "public_repo" to generate personal access token */ -}}
|
||||
{{- $header := dict "Authorization" "" -}}
|
||||
{{- with $devOpts.githubtoken -}}
|
||||
{{- $header = dict "Authorization" (printf "token %v" .) -}}
|
||||
{{- end -}}
|
||||
{{- $latest = (getJSON "https://api.github.com/repos/hugo-fixit/FixIt/releases/latest" $header).tag_name -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* FixIt theme version detection */ -}}
|
||||
{{- if eq .Site .Sites.First -}}
|
||||
{{- 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 -}}
|
6
themes/FixIt/layouts/partials/init/global.html
Normal file
6
themes/FixIt/layouts/partials/init/global.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{- /* Set customFilePath default value */ -}}
|
||||
{{- $customFilePath := .Site.Params.customFilePath -}}
|
||||
{{- $customFilePath = dict "aside" ($customFilePath.aside | default "custom/aside.html") | merge $customFilePath -}}
|
||||
{{- $customFilePath = dict "profile" ($customFilePath.profile | default "custom/profile.html") | merge $customFilePath -}}
|
||||
{{- $customFilePath = dict "footer" ($customFilePath.footer | default "custom/footer.html") | merge $customFilePath -}}
|
||||
{{- .Scratch.Set "customFilePath" $customFilePath -}}
|
11
themes/FixIt/layouts/partials/init/index.html
Normal file
11
themes/FixIt/layouts/partials/init/index.html
Normal file
@ -0,0 +1,11 @@
|
||||
{{- .Scratch.Set "version" "v0.2.18" -}}
|
||||
{{- .Scratch.Set "params" (.Params | merge .Site.Params.page) -}}
|
||||
{{- .Scratch.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
{{- partial "init/detection-version.html" . -}}
|
||||
{{- partial "init/detection-deprecated.html" . -}}
|
||||
{{- partial "init/global.html" . -}}
|
||||
{{- partial "init/patch.html" . -}}
|
||||
|
||||
{{- partial "plugin/compatibility.html" . -}}
|
70
themes/FixIt/layouts/partials/init/patch.html
Normal file
70
themes/FixIt/layouts/partials/init/patch.html
Normal file
@ -0,0 +1,70 @@
|
||||
{{- /* FixIt theme patches */ -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- /* Author data patch */ -}}
|
||||
{{- $authorDefault := dict "name" "Anonymous" "link" "" "email" "" "avatar" "" -}}
|
||||
{{- $author := .Site.Author | merge $authorDefault -}}
|
||||
{{- $authorPost := dict -}}
|
||||
{{- $gravatar := .Site.Params.gravatar -}}
|
||||
{{- if reflect.IsMap $params.author -}}
|
||||
{{- $authorPost = $params.author -}}
|
||||
{{- else if isset $params "author" -}}
|
||||
{{- $authorPost = dict "name" $params.author -}}
|
||||
{{- end -}}
|
||||
{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Author.name) -}}
|
||||
{{- $author = $authorPost | merge $authorDefault | merge $author -}}
|
||||
{{- else -}}
|
||||
{{- with $authorPost.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
|
||||
{{- with $authorPost.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}}
|
||||
{{- with $authorPost.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $gravatar.enable | and $author.email -}}
|
||||
{{- with $gravatar -}}
|
||||
{{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v"
|
||||
(path.Clean .Host | default "www.gravatar.com")
|
||||
(md5 $author.email)
|
||||
(.Style | default ""))
|
||||
| merge $author
|
||||
-}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "author" $author -}}
|
||||
|
||||
{{- /* Toc data patch */ -}}
|
||||
{{- $toc := $params.toc -}}
|
||||
{{- if eq $toc true -}}
|
||||
{{- $toc = dict "enable" true | merge .Site.Params.page.toc -}}
|
||||
{{- else if eq $toc false -}}
|
||||
{{- $toc = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "toc" $toc -}}
|
||||
|
||||
{{- /* Reward data patch */ -}}
|
||||
{{- $reward := $params.reward -}}
|
||||
{{- if eq $reward true -}}
|
||||
{{- $reward = dict "enable" true | merge .Site.Params.page.reward -}}
|
||||
{{- else if eq $reward false -}}
|
||||
{{- $reward = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "reward" $reward -}}
|
||||
|
||||
{{- /* KaTeX data patch */ -}}
|
||||
{{- $math := $params.math -}}
|
||||
{{- if eq $math true -}}
|
||||
{{- $math = dict "enable" true | merge .Site.Params.page.math -}}
|
||||
{{- else if eq $math false -}}
|
||||
{{- $math = dict "enable" false -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "math" $math -}}
|
||||
|
||||
{{- /* SiteTime config patch */ -}}
|
||||
{{- $siteTime := dict "Animate" true "Icon" "fa-solid fa-heartbeat" -}}
|
||||
{{- with .Site.Params.footer.siteTime -}}
|
||||
{{- if reflect.IsMap . -}}
|
||||
{{- $siteTime = . -}}
|
||||
{{- else -}}
|
||||
{{- $siteTime = dict "enable" true "value" . | merge $siteTime -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- .Scratch.Set "siteTime" $siteTime -}}
|
Reference in New Issue
Block a user