From 86c6972cf21a92f86b1e659939e5fd1559146e47 Mon Sep 17 00:00:00 2001 From: Dillon Date: Tue, 10 Mar 2020 11:50:07 +0800 Subject: [PATCH] feat(comment): add enable for disqus and gitalk --- exampleSite/config.toml | 10 ++++++---- .../content/posts/theme-documentation-basics.en.md | 6 +++++- .../content/posts/theme-documentation-basics.fr.md | 6 +++++- .../content/posts/theme-documentation-basics.zh-cn.md | 8 ++++++-- layouts/partials/comment.html | 6 +++--- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index ac8dbc76..873a2fd2 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -209,7 +209,7 @@ enableEmoji = true [languages.en.params.comment.disqus] # Disqus shortname to use Disqus in posts shortname = "" - # Gittalk Comment Config (https://github.com/gitalk/gitalk) + # Gitalk Comment Config (https://github.com/gitalk/gitalk) [languages.en.params.comment.gitalk] owner = "" repo = "" @@ -422,9 +422,9 @@ enableEmoji = true enable = true # Disqus 评论系统设置 (https://disqus.com/) [languages.zh-cn.params.comment.disqus] - # Disqus 的用户名,用来在文章中启用 Disqus 评论系统 + # Disqus 的 shortname,用来在文章中启用 Disqus 评论系统 shortname = "" - # Gittalk 评论系统设置 (https://github.com/gitalk/gitalk) + # Gitalk 评论系统设置 (https://github.com/gitalk/gitalk) [languages.zh-cn.params.comment.gitalk] owner = "" repo = "" @@ -637,10 +637,12 @@ enableEmoji = true enable = true # Disqus Comment Config (https://disqus.com/) [languages.fr.params.comment.disqus] + enable = false # Disqus shortname to use Disqus in posts shortname = "" - # Gittalk Comment Config (https://github.com/gitalk/gitalk) + # Gitalk Comment Config (https://github.com/gitalk/gitalk) [languages.fr.params.comment.gitalk] + enable = false owner = "" repo = "" clientId = "" diff --git a/exampleSite/content/posts/theme-documentation-basics.en.md b/exampleSite/content/posts/theme-documentation-basics.en.md index 06586227..79c49ea9 100644 --- a/exampleSite/content/posts/theme-documentation-basics.en.md +++ b/exampleSite/content/posts/theme-documentation-basics.en.md @@ -348,10 +348,14 @@ Note that some of these parameters are explained in details in other sections of enable = true # Disqus Comment Config (https://disqus.com/) [params.comment.disqus] + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false # Disqus shortname to use Disqus in posts shortname = "" - # Gittalk Comment Config (https://github.com/gitalk/gitalk) + # Gitalk Comment Config (https://github.com/gitalk/gitalk) [params.comment.gitalk] + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false owner = "" repo = "" clientId = "" diff --git a/exampleSite/content/posts/theme-documentation-basics.fr.md b/exampleSite/content/posts/theme-documentation-basics.fr.md index bf571ec0..9a8aa3b1 100644 --- a/exampleSite/content/posts/theme-documentation-basics.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics.fr.md @@ -353,10 +353,14 @@ Note that some of these parameters are explained in details in other sections of enable = true # Disqus Comment Config (https://disqus.com/) [params.comment.disqus] + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false # Disqus shortname to use Disqus in posts shortname = "" - # Gittalk Comment Config (https://github.com/gitalk/gitalk) + # Gitalk Comment Config (https://github.com/gitalk/gitalk) [params.comment.gitalk] + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false owner = "" repo = "" clientId = "" diff --git a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md index fea2ed8f..b832dff5 100644 --- a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md @@ -350,10 +350,14 @@ hugo enable = true # Disqus 评论系统设置 (https://disqus.com/) [params.comment.disqus] - # Disqus 的用户名,用来在文章中启用 Disqus 评论系统 + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false + # Disqus 的 shortname,用来在文章中启用 Disqus 评论系统 shortname = "" - # Gittalk 评论系统设置 (https://github.com/gitalk/gitalk) + # Gitalk 评论系统设置 (https://github.com/gitalk/gitalk) [params.comment.gitalk] + # LoveIt :(fas fa-greater-than-equal): :(far fa-file-archive): v0.1.1 + enable = false owner = "" repo = "" clientId = "" diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index b24ab1a7..6a97d9bb 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -4,9 +4,9 @@ {{- $CDN := $scratch.Get "CDN" -}} {{- /* Disqus Comment System */ -}} - {{- with .Site.Params.comment.disqus.shortname -}} + {{- if .Site.Params.comment.disqus.enable -}}
- {{- $script := printf `` . -}} + {{- $script := printf `` .Site.Params.comment.disqus.shortname -}} {{- slice $script | $scratch.Add "scriptCDN" -}}