65 lines
1.9 KiB
HTML
65 lines
1.9 KiB
HTML
{{ $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 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 }}
|
|
{{ $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 }}
|
|
|
|
<script class="next-config" data-name="page" type="application/json">{{ $pageCfg }}</script> |