Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(comment): add enable for disqus and gitalk
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Mar 10, 2020
1 parent da71fee commit 86c6972
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
10 changes: 6 additions & 4 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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 = ""
Expand Down
6 changes: 5 additions & 1 deletion exampleSite/content/posts/theme-documentation-basics.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
6 changes: 5 additions & 1 deletion exampleSite/content/posts/theme-documentation-basics.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
8 changes: 6 additions & 2 deletions exampleSite/content/posts/theme-documentation-basics.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
{{- $CDN := $scratch.Get "CDN" -}}

{{- /* Disqus Comment System */ -}}
{{- with .Site.Params.comment.disqus.shortname -}}
{{- if .Site.Params.comment.disqus.enable -}}
<div id="disqus_thread"></div>
{{- $script := printf `<script defer src="https://%s.disqus.com/embed.js"></script>` . -}}
{{- $script := printf `<script defer src="https://%s.disqus.com/embed.js"></script>` .Site.Params.comment.disqus.shortname -}}
{{- slice $script | $scratch.Add "scriptCDN" -}}
<noscript>
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
</noscript>
{{- end -}}

{{- /* Gitalk Comment System */ -}}
{{- if .Site.Params.comment.gitalk.owner -}}
{{- if .Site.Params.comment.gitalk.enable -}}
{{- $gitalk := .Site.Params.comment.gitalk -}}
<div id="gitalk"></div>
{{- with $CDN.gitalkCSS -}}
Expand Down

0 comments on commit 86c6972

Please sign in to comment.