💄 Add comment counter in home & page.
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
"title" .Page.Title
|
||||
-}}
|
||||
|
||||
{{/* Append waline pageview plugin */}}
|
||||
{{ if and .Site.Params.waline .Site.Params.waline.pageView }}
|
||||
{{ $pageview := dict
|
||||
{{/* Append waline pageview & comment plugin */}}
|
||||
{{ if and .Site.Params.waline ( or .Site.Params.waline.pageView .Site.Params.waline.comment) }}
|
||||
{{ $counter := dict
|
||||
"js" .Site.Data.resources.plugins.waline.js
|
||||
}}
|
||||
{{ $pageCfg = merge $pageCfg (dict "pageview" $pageview) }}
|
||||
{{ $pageCfg = merge $pageCfg (dict "waline" $counter) }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Append mermaid plugin */}}
|
||||
|
||||
@@ -27,17 +27,25 @@
|
||||
{{ partial "post/header_meta/created_date.html" . }}
|
||||
{{ partial "post/header_meta/update_date.html" . }}
|
||||
{{ partial "post/header_meta/categories.html" . }}
|
||||
{{ if .Site.Params.waline.pageView }}
|
||||
{{ if and $.IsHome (not (isset .Params "extlink")) }}
|
||||
{{ partial "post/header_meta/views.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if and $.IsHome (not (isset .Params "extlink")) }}
|
||||
<div class="post-meta-items">
|
||||
{{ if .Site.Params.waline.pageView }}
|
||||
{{ partial "post/header_meta/views.html" . }}
|
||||
{{ end }}
|
||||
{{ if .Site.Params.waline.comment }}
|
||||
{{ partial "post/header_meta/comments.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- if not $.IsHome }}
|
||||
<div class="post-meta-items">
|
||||
{{ partial "post/header_meta/words.html" . }}
|
||||
{{ partial "post/header_meta/readtime.html" . }}
|
||||
{{ partial "post/header_meta/views.html" . }}
|
||||
{{ if .Site.Params.waline.comment }}
|
||||
{{ partial "post/header_meta/comments.html" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
11
layouts/partials/post/header_meta/comments.html
Normal file
11
layouts/partials/post/header_meta/comments.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<span class="post-meta-item" title="{{ T "PostComments" }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-comments"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">
|
||||
{{ print (T "PostComments") (T "SymbolColon") }}
|
||||
</span>
|
||||
<span {{ with .Site.Params.waline.comment }}class="waline-comment-count"{{end}} data-path="{{ .RelPermalink | relLangURL }}">
|
||||
<i class="fa fa-sync fa-spin"></i>
|
||||
</span>
|
||||
</span>
|
||||
@@ -49,9 +49,9 @@
|
||||
{{ if isset .Site.Params "waline" }}
|
||||
{{ $walinejs := resources.Get "js/third-party/comments/waline.js" }}
|
||||
{{ $nextjs = $nextjs | append $walinejs }}
|
||||
{{ if .Site.Params.waline.pageView }}
|
||||
{{ $pageviewjs := resources.Get "js/third-party/others/pageview.js" }}
|
||||
{{ $nextjs = $nextjs | append $pageviewjs }}
|
||||
{{ if or .Site.Params.waline.pageView .Site.Params.waline.comment }}
|
||||
{{ $counterjs := resources.Get "js/third-party/others/counter.js" }}
|
||||
{{ $nextjs = $nextjs | append $counterjs }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if isset .Site.Params "giscus" }}
|
||||
|
||||
Reference in New Issue
Block a user