Update theme (LoveIt) + Add new fields

This commit is contained in:
Daniel Mason 2025-02-23 12:23:14 +13:00
parent ec90ebd36e
commit 49c98d8fb5
Signed by: idanoo
GPG key ID: 387387CDBC02F132
87 changed files with 6900 additions and 6013 deletions

View file

@ -0,0 +1 @@
{{- dict "Content" .Inner "Lang" .Type "Options" .Options | partial "plugin/code-block.html" -}}

View file

@ -35,7 +35,9 @@
<a href="#" id="back-to-top" class="fixed-button" title="{{ T `backToTop` }}">
<i class="fas fa-arrow-up fa-fw" aria-hidden="true"></i>
</a>
</div>
<div id="fixed-buttons-hidden">
{{- /* comment button */ -}}
<a href="#" id="view-comments" class="fixed-button" title="{{ T `viewComments` }}">
<i class="fas fa-comment fa-fw" aria-hidden="true"></i>

View file

@ -24,8 +24,8 @@
{{- /* Meta */ -}}
<div class="post-meta">
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
{{- $author := $params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Params.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/a.html" $options -}}

View file

@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}

View file

@ -24,7 +24,7 @@
{{- dict "Source" (T "lunrLanguageLib") "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- end -}}
{{- else if eq $search.type "algolia" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}}
{{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/lite/browser.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}}
{{- end -}}
@ -52,6 +52,7 @@
{{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/plugins/zoom/lg-zoom.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "lightgallery" true | merge $config -}}
{{- $_ := (resources.Get "lib/lightgallery/images/loading.gif").RelPermalink -}}
{{- end -}}
{{- $code := $params.code | default dict -}}
@ -152,7 +153,9 @@
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}}
{{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}}
{{- /* To fix https://github.com/dillonzq/LoveIt/issues/869 */ -}}
{{- /* Local file from https://github.com/DIYgod/APlayer/pull/777, no CDN */ -}}
{{- $source := "lib/aplayer/APlayer.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- /* MetingJS */ -}}

View file

@ -32,7 +32,7 @@
{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
<span class="author" itemprop="copyrightHolder">&nbsp;<a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank">{{ .Site.Author.name }}</a></span>
<span class="author" itemprop="copyrightHolder">&nbsp;<a href="{{ $.Site.Params.Author.link | default .Site.Home.RelPermalink }}" target="_blank">{{ .Site.Params.Author.name }}</a></span>
{{- end -}}
{{- /* License */ -}}

View file

@ -0,0 +1,18 @@
{{- /* To Bool */ -}}
{{- $bool := . -}}
{{- if eq . true -}}
{{- $bool = true -}}
{{- else if eq . false -}}
{{- $bool = false -}}
{{- else if eq . "true" -}}
{{- $bool = true -}}
{{- else if eq . "false" -}}
{{- $bool = false -}}
{{- else if eq . "1" -}}
{{- $bool = true -}}
{{- else if eq . "0" -}}
{{- $bool = false -}}
{{- end -}}
{{- return $bool -}}

View file

@ -0,0 +1,14 @@
{{- /* To Dict */ -}}
{{- /* "a=1, b=2" -> dict "a" "1" "b" "2" */ -}}
{{- $dict := dict -}}
{{- if reflect.IsMap . -}}
{{- $dict = . -}}
{{- else -}}
{{- range split . "," -}}
{{- $parts := split (trim . " ") "=" -}}
{{- $dict = dict (index $parts 0) (delimit (after 1 $parts) "") | merge $dict -}}
{{- end -}}}
{{- end -}}
{{- return $dict -}}

View file

@ -26,7 +26,7 @@
{{- with .Site.LanguageCode -}}
"inLanguage": "{{ . }}",
{{- end -}}
{{- with .Site.Author.name -}}
{{- with .Site.Params.Author.name -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
@ -122,7 +122,7 @@
{{- with .Site.Copyright -}}
"license": {{ . | safeHTML }},
{{- end -}}
{{- $publisher := .Params.author | default .Site.Author.name | default (T "author") | dict "name" -}}
{{- $publisher := .Params.author | default .Site.Params.Author.name | default (T "author") | dict "name" -}}
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
"publisher": {
"@type": "Organization",
@ -141,7 +141,7 @@
{{- end -}}
{{- end -}}
},
{{- with .Params.author | default .Site.Author.name | default (T "author") -}}
{{- with .Params.author | default .Site.Params.Author.name | default (T "author") -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
@ -150,4 +150,4 @@
"description": {{ .Description | safeHTML }}
}
</script>
{{- end -}}
{{- end -}}

View file

@ -57,9 +57,9 @@
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
{{- if .Site.IsMultiLingual -}}
{{- if hugo.IsMultilingual -}}
<a href="javascript:void(0);" class="menu-item language" title="{{ T "selectLanguage" }}">
<i class="fa fa-globe" aria-hidden="true"></i>
<i class="fa fa-globe fa-fw" aria-hidden="true"></i>
<select class="language-select" id="language-select-desktop" onchange="location = this.value;">
{{- if eq .Kind "404" -}}
{{- /* https://github.com/dillonzq/LoveIt/issues/378 */ -}}
@ -149,7 +149,7 @@
<a href="javascript:void(0);" class="menu-item theme-switch" title="{{ T "switchTheme" }}">
<i class="fas fa-adjust fa-fw" aria-hidden="true"></i>
</a>
{{- if .Site.IsMultiLingual -}}
{{- if hugo.IsMultilingual -}}
<a href="javascript:void(0);" class="menu-item" title="{{ T "selectLanguage" }}">
<i class="fa fa-globe fa-fw" aria-hidden="true"></i>

View file

@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "0.2.11" -}}
{{- .Scratch.Set "version" "0.3.0" -}}
{{- $params := .Params | merge .Site.Params.page -}}
@ -21,8 +21,9 @@
{{- else if eq .Params.comment false -}}
{{- .Scratch.Set "comment" dict -}}
{{- end -}}
{{- else if eq .Site .Sites.First -}}
{{- warnf "\n\nCurrent environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
{{- else if eq .Site .Sites.Default -}}
{{- warnf "Current environment is \"development\". The \"comment system\", \"CDN\" and \"fingerprint\" will be disabled.\n" -}}
{{- warnf "当前运行环境是 \"development\". \"评论系统\", \"CDN\" 和 \"fingerprint\" 不会启用.\n" -}}
{{- end -}}
{{- .Scratch.Set "params" $params -}}

View file

@ -0,0 +1,17 @@
{{- $content := .Content -}}
{{- $lang := .Lang -}}
{{- $options := dict "lineNoStart" 1 "lineNos" true -}}
{{- $options = .Options | partial "function/dict.html" | merge $options -}}
{{- $lineNoStart := $options.lineNoStart | int -}}
{{- $lineNos := $options.lineNos | partial "function/bool.html" -}}
{{- $options = dict "noClasses" false "lineNos" false | merge $options -}}
{{- $result := transform.Highlight $content $lang $options -}}
<div class="code-block{{ if $lineNos }} code-line-numbers{{ end }} open" style="counter-reset: code-block {{ sub $lineNoStart 1 }}">
<div class="code-header language-bash">
<span class="code-title"><i class="arrow fas fa-chevron-right fa-fw" aria-hidden="true"></i></span>
<span class="ellipses"><i class="fas fa-ellipsis-h fa-fw" aria-hidden="true"></i></span>
<span class="copy" title="{{ T "copyToClipboard" }}"><i class="far fa-copy fa-fw" aria-hidden="true"></i></span>
</div>
{{- $result -}}
</div>

View file

@ -1,4 +1,4 @@
{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Author.name) -}}
{{- $params := .Page.Params | merge .Site.Params.Page | merge (dict "author" .Site.Params.Author.name) -}}
<item>
<title>
{{- .Page.Title -}}

View file

@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}

View file

@ -30,8 +30,8 @@
{{- /* Meta */ -}}
<div class="post-meta">
<div class="post-meta-line">
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
{{- $author := $params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Params.Author.link | default .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
{{- partial "plugin/a.html" $options -}}

View file

@ -0,0 +1,7 @@
{{- $content := trim .InnerDeindent "\n\r" -}}
{{- $lang := .Get 0 -}}
{{- $options := "" -}}
{{- if len .Params | eq 2 -}}
{{- $options = .Get 1 -}}
{{- end -}}
{{- dict "Content" $content "Lang" $lang "Options" $options | partial "plugin/code-block.html" -}}

View file

@ -3,7 +3,7 @@
{{- $type := .Get 1 | default "new" | lower -}}
{{- $label := T $type -}}
{{- $color := cond (eq $type "changed") "ff9101" "00b1ff" | cond (eq $type "deleted") "ff5252" -}}
{{- $pathTemplate := cond .Site.IsMultiLingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
{{- $pathTemplate := cond hugo.IsMultilingual (printf "svg/version/%%v-%%v.%v.svg" .Page.Language.Lang) "svg/version/%v-%v.svg" -}}
{{- $path := printf $pathTemplate $version $type -}}
{{- $resource := resources.Get "svg/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}

View file

@ -15,12 +15,12 @@
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Author.email -}}
{{- with .Site.Params.Author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Author.name }} ({{ . }}){{ end -}}
{{- . }}{{ with $.Site.Params.Author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}