2025-01-15 21:42:22 +08:00
|
|
|
|
|
|
|
{{/** Short code params **/}}
|
|
|
|
{{ $scParam := .Store.Get "scParams" }}
|
|
|
|
|
2023-01-01 21:12:58 +08:00
|
|
|
{{ $pageCfg := dict
|
2022-07-22 17:16:34 +08:00
|
|
|
"isHome" .IsHome
|
|
|
|
"isPage" .IsPage
|
2022-10-30 21:04:08 +08:00
|
|
|
"comments" (.Scratch.Get "isComment")
|
2025-01-03 20:48:41 +08:00
|
|
|
"toc" (default .Site.Params.toc.enable .Params.Toc)
|
2022-07-22 17:16:34 +08:00
|
|
|
"permalink" (.Page.Permalink | absURL)
|
|
|
|
"path" (.Page.Permalink | path.Base)
|
|
|
|
"title" .Page.Title
|
2023-01-01 21:12:58 +08:00
|
|
|
}}
|
2022-10-27 15:57:42 +08:00
|
|
|
|
2025-01-06 13:26:27 +08:00
|
|
|
{{/** Append APlayer plugin */}}
|
2025-01-15 21:42:22 +08:00
|
|
|
{{ if $scParam.music }}
|
2025-01-06 13:26:27 +08:00
|
|
|
{{ $aplayer := dict
|
|
|
|
"js" $.Site.Data.resources.plugins.music.js
|
|
|
|
"css" $.Site.Data.resources.plugins.music.css
|
|
|
|
}}
|
2025-01-15 21:42:22 +08:00
|
|
|
{{ $pageCfg = merge $pageCfg (dict "music" $aplayer) }}
|
2025-01-06 13:26:27 +08:00
|
|
|
{{ end }}
|
|
|
|
|
2025-01-03 20:48:41 +08:00
|
|
|
{{/* 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 }}
|
|
|
|
|
2022-10-30 11:43:18 +08:00
|
|
|
{{/* Append waline pageview & comment plugin */}}
|
2024-08-03 18:56:01 +08:00
|
|
|
{{ 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 }}
|
2022-10-29 18:15:39 +08:00
|
|
|
{{ end }}
|
|
|
|
|
2022-10-27 15:57:42 +08:00
|
|
|
{{/* Append mermaid plugin */}}
|
2025-01-15 21:42:22 +08:00
|
|
|
{{ if $scParam.mermaid }}
|
2022-10-27 15:57:42 +08:00
|
|
|
{{ $mermaid := dict
|
|
|
|
"js" .Site.Data.resources.plugins.mermaid.js
|
|
|
|
}}
|
|
|
|
{{ $pageCfg = merge $pageCfg (dict "mermaid" $mermaid) }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{/* Append math render plugin */}}
|
|
|
|
{{ with or .Params.math .Site.Params.math }}
|
|
|
|
{{ $math := dict
|
|
|
|
"render" .
|
|
|
|
"js" (index $.Site.Data.resources.plugins .).js
|
|
|
|
}}
|
|
|
|
|
|
|
|
{{ if eq . "katex" }}
|
|
|
|
{{ $math = merge $math ( dict "css" $.Site.Data.resources.plugins.katex.css ) }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ $pageCfg = merge $pageCfg (dict "math" $math) }}
|
|
|
|
{{ end }}
|
|
|
|
|
2025-01-15 21:42:22 +08:00
|
|
|
<script class="next-config" data-name="page" type="application/json">{{ $pageCfg }}</script>
|
|
|
|
|
|
|
|
{{/** Special CSS Style for page **/}}
|
|
|
|
{{ if .IsPage }}
|
|
|
|
<style type="text/css">
|
|
|
|
.post-footer, .flinks-list-footer hr:after {
|
|
|
|
content: "{{ .Site.Params.postFooter.endLineTip }}";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
{{ end }}
|