{{ $randNums := (seq 10) }}
{{- range $name, $items := $tags }}
- {{ .Page.Title }}
+ {{ .Page.Title }}
({{ len $items }})
diff --git a/layouts/flinks/single.html b/layouts/flinks/single.html
index ae897ea..d7916c8 100644
--- a/layouts/flinks/single.html
+++ b/layouts/flinks/single.html
@@ -5,9 +5,16 @@
{{ define "main" }}
-
{{ .Title }}
+{{ .Title }}
+
- {{ range .Site.Data.flinks }}
+ {{ $flinksData := "" }}
+ {{ if .IsTranslated }}
+ {{ $flinksData = index .Site.Data.flinks .Lang }}
+ {{ else }}
+ {{ $flinksData = .Site.Data.flinks }}
+ {{ end }}
+ {{ range $flinksData }}
-
+
{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/_funs/add_unix_param.html b/layouts/partials/_funs/add_unix_param.html
new file mode 100644
index 0000000..44db9b9
--- /dev/null
+++ b/layouts/partials/_funs/add_unix_param.html
@@ -0,0 +1,4 @@
+{{/** Add unix time end of link URL. **/}}
+{{ $timeUnix := time.Now.Unix }}
+{{ $withTimeLink := printf "%s?=%d" . $timeUnix }}
+{{ return $withTimeLink }}
\ No newline at end of file
diff --git a/layouts/partials/_funs/cal_siteinfo.html b/layouts/partials/_funs/cal_siteinfo.html
index b1fe5ab..2f0f714 100644
--- a/layouts/partials/_funs/cal_siteinfo.html
+++ b/layouts/partials/_funs/cal_siteinfo.html
@@ -1,3 +1,4 @@
+{{/** Calculate some information for site operation **/}}
{{ $scratch := newScratch }}
{{ $pages := (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections).ByLastmod.Reverse }}
@@ -7,10 +8,11 @@
{{ end }}
{{ range first 1 $pages }}
- {{ $scratch.Set "first" (time.Format .Site.Params.timeFormat .Date) }}
+ {{ $lastMod := default .Date .Lastmod }}
+ {{ $scratch.Set "first" $lastMod }}
{{ end }}
{{ range last 1 $pages }}
- {{ $scratch.Set "last" (time.Format .Site.Params.timeFormat .Date) }}
+ {{ $scratch.Set "last" .Date }}
{{ end }}
{{ return $scratch }}
\ No newline at end of file
diff --git a/layouts/partials/_funs/get_res.html b/layouts/partials/_funs/get_cdn_res.html
similarity index 100%
rename from layouts/partials/_funs/get_res.html
rename to layouts/partials/_funs/get_cdn_res.html
diff --git a/layouts/partials/_funs/get_plugin.html b/layouts/partials/_funs/get_plugin.html
index e25a3ef..70d6a00 100644
--- a/layouts/partials/_funs/get_plugin.html
+++ b/layouts/partials/_funs/get_plugin.html
@@ -1,11 +1,11 @@
{{/* Get third party js plugins resource */}}
-{{ $pluginPath := printf "%s/%s/%s" "js/third-party" .class .plugin }}
+{{ $pluginPath := printf "%s/%s/%s" "js/3rd" .class .plugin }}
{{ $targetPath := printf "js/%s" .plugin }}
{{ $plugin := resources.Get $pluginPath | resources.ExecuteAsTemplate $targetPath .ctx }}
{{ if hugo.IsProduction }}
-{{ $plugin = $plugin | minify | fingerprint }}
+{{ $plugin = $plugin | minify }}
{{ end }}
-
-
\ No newline at end of file
+{{ $unixSrc := partial "_funs/add_unix_param.html" $plugin.RelPermalink }}
+
\ No newline at end of file
diff --git a/layouts/partials/_thirdparty/comment/waline3.html b/layouts/partials/_thirdparty/comment/waline3.html
new file mode 100644
index 0000000..3a397f8
--- /dev/null
+++ b/layouts/partials/_thirdparty/comment/waline3.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/layouts/partials/_thirdparty/share/addthis.html b/layouts/partials/_thirdparty/share/addthis.html
deleted file mode 100644
index 520e2e1..0000000
--- a/layouts/partials/_thirdparty/share/addthis.html
+++ /dev/null
@@ -1,3 +0,0 @@
-{{ if isset .Site.Params "addthisid" }}
-
-{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/_thirdparty/share/addtoany.html b/layouts/partials/_thirdparty/share/addtoany.html
new file mode 100644
index 0000000..f2a2718
--- /dev/null
+++ b/layouts/partials/_thirdparty/share/addtoany.html
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/layouts/partials/_thirdparty/share/sharethis.html b/layouts/partials/_thirdparty/share/sharethis.html
new file mode 100644
index 0000000..74b3f22
--- /dev/null
+++ b/layouts/partials/_thirdparty/share/sharethis.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 24bfa31..f69d2d6 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,10 +1,4 @@
{{ $ft := .Site.Params.footer }}
-{{ if $ft.translate }}
-{{ .FLinksTitle | safeHTML }}
{{ .FLinksDesc | safeHTML }}
@@ -32,5 +39,5 @@
{{ .Content }}
-
-
-
-{{ end }}
©
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index db03735..c63085a 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -4,7 +4,7 @@
{{ partial "head/googleplus.html" . }}
{{ partial "head/facebook.html" . }}
{{ partial "head/verify.html" . }}
-{{ partialCached "head/style.html" . }}
+{{ partial "head/styles.html" . }}
-{{ partial "head/config.html" . }}
-{{ partialCached "head/analytics.html" . }}
+{{ partialCached "head/script/analytics.html" . }}
diff --git a/layouts/partials/head/config.html b/layouts/partials/head/config.html
index 777f8a4..5e1fe68 100644
--- a/layouts/partials/head/config.html
+++ b/layouts/partials/head/config.html
@@ -1,22 +1,68 @@
+
+{{/** Short code params **/}}
+{{ $scParam := .Store.Get "scParams" }}
+
{{ $pageCfg := dict
"isHome" .IsHome
"isPage" .IsPage
"comments" (.Scratch.Get "isComment")
+ "toc" (default .Site.Params.toc.enable .Params.Toc)
"permalink" (.Page.Permalink | absURL)
"path" (.Page.Permalink | path.Base)
"title" .Page.Title
}}
-{{/* Append waline pageview & comment plugin */}}
-{{ if or (eq .Site.Params.postMeta.views.plugin "waline") (eq .Site.Params.postMeta.comments.plugin "waline") }}
-{{ $counter := dict
- "js" .Site.Data.resources.plugins.waline.js
+{{/** Append clipboard plugin */}}
+{{ if .Store.Get "codeblock" }}
+{{ $clipboard := dict
+ "js" $.Site.Data.resources.plugins.clipboard.js
}}
-{{ $pageCfg = merge $pageCfg (dict "waline" $counter) }}
+{{ $pageCfg = merge $pageCfg (dict "clipboard" $clipboard) }}
+{{ end }}
+
+{{/** Append APlayer plugin */}}
+{{ if $scParam.music }}
+{{ $aplayer := dict
+ "js" $.Site.Data.resources.plugins.music.js
+ "css" $.Site.Data.resources.plugins.music.css
+}}
+{{ $pageCfg = merge $pageCfg (dict "music" $aplayer) }}
+{{ end }}
+
+{{/* Append post expired config */}}
+{{ $expired := default .Site.Params.PostMeta.expired .Params.Expired }}
+{{ $pageCfg = merge $pageCfg (dict "expired" $expired) }}
+{{ if $expired }}
+{{ $expiredTips := dict
+ "info" (T "PostMeta.expired.info")
+ "warn" (T "PostMeta.expired.warn")
+}}
+{{ $pageCfg = merge $pageCfg (dict "expiredTips" $expiredTips) }}
+{{ end }}
+
+{{/* Append waline pageview & comment plugin */}}
+{{ with .Site.Params.postMeta.views }}
+ {{ if and .enable (ne .plugin "busuanzi") }}
+ {{ $plugin := .plugin }}
+ {{ $counter := dict
+ "pagecnt" (index ($.Site.Data.resources.plugins) $plugin "js" 0)
+ }}
+ {{ $pageCfg = merge $pageCfg (dict $plugin $counter) }}
+ {{ end }}
+{{ end }}
+
+{{ with .Site.Params.postMeta.comments }}
+ {{ if .enable }}
+ {{ $plugin := .plugin }}
+ {{ $counter := dict
+ "commentcnt" (index ($.Site.Data.resources.plugins) $plugin "js" 1)
+ }}
+ {{ $pageCfg = merge $pageCfg (dict $plugin $counter) }}
+ {{ end }}
{{ end }}
{{/* Append mermaid plugin */}}
-{{ if .Params.mermaid }}
+{{ if $scParam.mermaid }}
{{ $mermaid := dict
"js" .Site.Data.resources.plugins.mermaid.js
}}
diff --git a/layouts/partials/head/analytics.html b/layouts/partials/head/script/analytics.html
similarity index 100%
rename from layouts/partials/head/analytics.html
rename to layouts/partials/head/script/analytics.html
diff --git a/layouts/partials/scripts/global.html b/layouts/partials/head/script/global.html
similarity index 60%
rename from layouts/partials/scripts/global.html
rename to layouts/partials/head/script/global.html
index 62826ed..7366bdc 100644
--- a/layouts/partials/scripts/global.html
+++ b/layouts/partials/head/script/global.html
@@ -3,7 +3,7 @@
{{ $vendor := .Site.Params.vendors.plugins }}
{{ $router := .Scratch.Get "router" }}
{{ range $jsRes }}
- {{ $pluginJS := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
+ {{ $pluginJS := partial "_funs/get_cdn_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
{{ end }}
@@ -40,62 +40,75 @@
{{ end }}
{{/* Share scripts */}}
-{{ if isset .Site.Params "addthisid" }}
-{{ $addthisjs := resources.Get "js/third-party/share/addthis.js" }}
-{{ $nextjs = $nextjs | append $addthisjs }}
+{{/** if and .Site.Params.share.enable (isset .Site.Params "sharethisid") }}
+{{ $sharethisjs := resources.Get "js/3rd/share/sharethis.js" }}
+{{ $nextjs = $nextjs | append $sharethisjs }}
+{{ end **/}}
+
+{{ with .Site.Params.share }}
+{{ if or .enable .Params.share }}
+ {{ if isset . "sharethis" }}
+ {{ $sharethisjs := resources.Get "js/3rd/share/sharethis.js" }}
+ {{ $nextjs = $nextjs | append $sharethisjs }}
+ {{ end }}
+ {{ if isset . "addtoany" }}
+ {{ $addtoanyjs := resources.Get "js/3rd/share/addtoany.js" }}
+ {{ $nextjs = $nextjs | append $addtoanyjs }}
+ {{ end }}
+{{ end }}
{{ end }}
{{/* Comments scripts */}}
{{ if isset .Site.Params "waline" }}
-{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
-{{ $nextjs = $nextjs | append $walinejs }}
+ {{ $walinejs := resources.Get "js/3rd/comments/waline.js" }}
+ {{ $nextjs = $nextjs | append $walinejs }}
+{{ end }}
+{{ if isset .Site.Params "waline3" }}
+ {{ $walinejs3 := resources.Get "js/3rd/comments/waline3.js" }}
+ {{ $nextjs = $nextjs | append $walinejs3 }}
+{{ end }}
{{ if or .Site.Params.postMeta.views.enable .Site.Params.postMeta.comments.enable }}
- {{ $counterjs := resources.Get "js/third-party/others/counter.js" }}
+ {{ $counterjs := resources.Get "js/3rd/others/counter.js" }}
{{ $nextjs = $nextjs | append $counterjs }}
- {{ end }}
{{ end }}
{{ if isset .Site.Params "giscus" }}
-{{ $giscusjs := resources.Get "js/third-party/comments/giscus.js" }}
+{{ $giscusjs := resources.Get "js/3rd/comments/giscus.js" }}
{{ $nextjs = $nextjs | append $giscusjs }}
{{ end}}
{{ if isset .Site.Params "livere" }}
-{{ $liverejs := resources.Get "js/third-party/comments/livere.js" }}
+{{ $liverejs := resources.Get "js/3rd/comments/livere.js" }}
{{ $nextjs = $nextjs | append $liverejs }}
{{ end }}
{{ if isset .Site.Params "artalk" }}
-{{ $artalkjs := resources.Get "js/third-party/comments/artalk.js" }}
+{{ $artalkjs := resources.Get "js/3rd/comments/artalk.js" }}
{{ $nextjs = $nextjs | append $artalkjs }}
{{ end }}
{{ if isset .Site.Params "utterances" }}
-{{ $utterancesjs := resources.Get "js/third-party/comments/utterances.js" }}
+{{ $utterancesjs := resources.Get "js/3rd/comments/utterances.js" }}
{{ $nextjs = $nextjs | append $utterancesjs }}
{{ end }}
{{/* Search engin scripts */}}
{{ if .Site.Params.localSearch.enable }}
-{{ $search := resources.Get "js/third-party/search/local.js" }}
+{{ $search := resources.Get "js/3rd/search/local.js" }}
{{ $nextjs = $nextjs | append $search }}
{{ end }}
{{ if .Site.Params.algoliaSearch.enable }}
-{{ $search := resources.Get "js/third-party/search/algolia.js" }}
+{{ $search := resources.Get "js/3rd/search/algolia.js" }}
{{ $nextjs = $nextjs | append $search }}
{{ end }}
{{/* Other not useful scripts, eg: 51la widget, translate */}}
{{ with .Site.Params.siteState.views }}
{{ if and .enable (eq .plugin "51la") }}
- {{ $lawt := resources.Get "js/third-party/others/lawidget.js" }}
+ {{ $lawt := resources.Get "js/3rd/others/lawidget.js" }}
{{ $nextjs = $nextjs | append $lawt }}
{{ end }}
{{ end }}
-{{ if .Site.Params.footer.translate }}
-{{ $translate := resources.Get "js/third-party/others/translate.js" }}
-{{ $nextjs = $nextjs | append $translate }}
-{{ end }}
-
{{ $nextjs = $nextjs | resources.Concat "js/main.js"}}
{{ if hugo.IsProduction }}
-{{ $nextjs = $nextjs | minify | fingerprint }}
+{{ $nextjs = $nextjs | minify }}
{{ end }}
-
\ No newline at end of file
+{{ $unixSrc := partial "_funs/add_unix_param.html" $nextjs.RelPermalink }}
+
\ No newline at end of file
diff --git a/layouts/partials/head/script/plugins.html b/layouts/partials/head/script/plugins.html
new file mode 100644
index 0000000..d2d38d1
--- /dev/null
+++ b/layouts/partials/head/script/plugins.html
@@ -0,0 +1,22 @@
+{{/* Defind loading plugin scripts which only need in pages */}}
+{{ if .IsPage }}
+
+{{/** Append codeblack render action **/}}
+{{ if .Store.Get "codeblock" }}
+ {{ partial "_funs/get_plugin.html" (dict "ctx" . "class" "others" "plugin" "clipboard.js") }}
+{{ end }}
+
+{{/** Short code params **/}}
+{{ $scParam := .Store.Get "scParams" }}
+
+{{/** Append math render action **/}}
+{{ if or .Params.math .Site.Params.math }}
+ {{ partial "_funs/get_plugin.html" (dict "ctx" . "class" "others" "plugin" "math.js") }}
+{{ end }}
+
+{{/** Append mermaid render action **/}}
+{{ if $scParam.mermaid }}
+ {{ partial "_funs/get_plugin.html" (dict "ctx" . "class" "others" "plugin" "mermaid.js") }}
+{{ end }}
+
+{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html
deleted file mode 100644
index 6faa942..0000000
--- a/layouts/partials/head/style.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-{{ $cssRes := .Site.Data.resources.css }}
-{{ $vendor := .Site.Params.vendors.plugins }}
-{{ $router := .Scratch.Get "router" }}
-
-{{ range $css := $cssRes }}
- {{ $pluginCss := partial "_funs/get_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
-
-{{ end }}
-
-
-{{ $scss := resources.Get "css/main.scss" }}
-{{ $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
-{{ $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
-{{ if hugo.IsProduction }}
-{{ $css = $css | minify | fingerprint }}
-{{ end }}
-
-{{ if .IsPage }}
-
-{{ end }}
-
-{{ $custom := .Scratch.Get "style" }}
-{{ if $custom }}
-
-{{ end }}
-
\ No newline at end of file
diff --git a/layouts/partials/head/styles.html b/layouts/partials/head/styles.html
new file mode 100644
index 0000000..0342de7
--- /dev/null
+++ b/layouts/partials/head/styles.html
@@ -0,0 +1,47 @@
+
+{{ $cssRes := .Site.Data.resources.css }}
+{{ $vendor := .Site.Params.vendors.plugins }}
+{{ $router := .Scratch.Get "router" }}
+
+{{ range $css := $cssRes }}
+ {{ $pluginCss := partial "_funs/get_cdn_res.html" (dict "res" . "vendor" $vendor "router" $router) }}
+
+{{ end }}
+
+
+{{ $scss := resources.Get "css/main.scss" }}
+{{ $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
+{{ $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
+{{ if hugo.IsProduction }}
+{{ $css = $css | minify }}
+{{ end }}
+{{ $unixHref := partial "_funs/add_unix_param.html" $css.RelPermalink }}
+
+
+
+
+
+
+{{ $custom := .Scratch.Get "style" }}
+{{ if $custom }}
+{{ $unixHref := partial "_funs/add_unix_param.html" $custom }}
+
+{{ end }}
+
\ No newline at end of file
diff --git a/layouts/partials/header/menus.html b/layouts/partials/header/menus.html
index 9dd2eaf..2716fab 100644
--- a/layouts/partials/header/menus.html
+++ b/layouts/partials/header/menus.html
@@ -3,7 +3,7 @@