diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 96837139..e4bab2a5 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -812,6 +812,7 @@ enableEmoji = true # 可以在你的项目下相同路径存放你自己的数据文件: # "assets/data/emoji/" emoji = "" + commentCount = true # since v0.2.13 # Waline comment config (https://waline.js.org) since v0.2.13 # Waline 评论系统设置 (https://waline.js.org) since v0.2.13 [params.page.comment.waline] diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index 4f15aa6d..d2ab2f85 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -574,6 +574,7 @@ Please open the code block below to view the complete sample configuration :(far # you can store your own data files in the same path under your project: # "assets/data/emoji/" emoji = "" + commentCount = true # {{< version 0.2.13 >}} # {{< version 0.2.13 >}} {{< link "https://waline.js.org" Waline >}} comment config (https://waline.js.org) [params.page.comment.waline] enable = false diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 79f3d4a9..0b27400d 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -585,6 +585,7 @@ hugo # 可以在你的项目下相同路径存放你自己的数据文件: # "assets/data/emoji/" emoji = "" + commentCount = true # {{< version 0.2.13 >}} # {{< version 0.2.13 >}} {{< link "https://waline.js.org" Waline >}} 评论系统设置 (https://waline.js.org) [params.page.comment.waline] enable = false diff --git a/i18n/en.toml b/i18n/en.toml index fcf966a0..fd7a5612 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -128,6 +128,9 @@ other = "{{ .Count }} minutes" [views] other = "views" +[comments] +other = "comments" + [author] other = "Author" diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 1ed55cd1..2e49e991 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -133,6 +133,9 @@ other = "预计阅读 {{ .Count }} 分钟" [views] other = "次阅读" +[comments] +other = "条评论" + [author] other = "作者" diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index 77686ae1..fbef6d9e 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -133,6 +133,9 @@ other = "預計閱讀 {{ .Count }} 分鐘" [views] other = "次閱讀" +[comments] +other = "條評論" + [author] other = "作者" diff --git a/layouts/posts/single.html b/layouts/posts/single.html index d5954394..d5ed3218 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -56,16 +56,43 @@  {{ T "wordCount" .WordCount }}   {{ T "readingTime" .ReadingTime }}  {{- $comment := .Scratch.Get "comment" | default dict -}} - {{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}} - -   {{ T "views" }} -   - {{- end -}} - {{- if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}} + {{- /* Visitor Count */ -}} + {{- if $comment.enable -}} + {{- if ($comment.valine.enable | and $comment.valine.visitor) | or ($comment.waline.enable | and $comment.waline.visitor) -}} + {{- /* Warning: waline v2 will not be compatible with valine */ -}} + +   {{ T "views" }} +   + {{- else if $comment.waline.enable | and $comment.waline.visitor -}} + +   {{ T "views" }} +   + {{- else if $comment.twikoo.enable | and $comment.twikoo.visitor -}} + +   {{ T "views" }} +   + {{- end -}} + {{- else if .Site.Params.ibruce.enable | and .Site.Params.ibruce.enablePost -}}   {{ T "views" }}   {{- end -}} + {{- /* Comment Count */ -}} + {{- if $comment.enable -}} + {{- if $comment.valine.enable | and $comment.valine.commentCount -}} + +   {{ T "comments" }} +   + {{- else if $comment.waline.enable | and $comment.waline.commentCount -}} + +   {{ T "comments" }} +   + {{- else if $comment.twikoo.enable | and $comment.twikoo.commentCount -}} + +   {{ T "comments" }} +   + {{- end -}} + {{- end -}}