redesign 2023
This commit is contained in:
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