summaryrefslogtreecommitdiff
path: root/layouts/partials/comments.html
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-05-31 22:41:10 +0800
committerReorx <novoreorx@gmail.com>2022-05-31 22:41:10 +0800
commit5c47607d23d31bda44f2f660df372a924daa2381 (patch)
tree314fb7db71f0a7b57d342ace9efdb20035d93e12 /layouts/partials/comments.html
parent81f885a7b99ac845348ba750a9419f50632fa985 (diff)
support specifying comment system in both config and front matter
in config: site.Params.defaultCommentSystems in front matter: pageCommentSystems
Diffstat (limited to 'layouts/partials/comments.html')
-rw-r--r--layouts/partials/comments.html30
1 files changed, 22 insertions, 8 deletions
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index a9d5391..36460f4 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -1,13 +1,27 @@
{{- /* You can add your own layouts/comments.html to override this file */ -}}
-{{- with site.Params.commentSystem.remark42 -}}
- {{- partial "remark42.html" . }}
-{{- end -}}
+{{- $pageCommentSystems := .Param "pageCommentSystems"}}
+{{- if not $pageCommentSystems }}
+ {{- $pageCommentSystems = site.Params.defaultCommentSystems }}
+{{- end }}
-{{- with site.Params.commentSystem.telegramWidget -}}
- {{- partial "telegram_widget.html" . }}
-{{- end -}}
+{{- $page := . -}}
+{{- with site.Params.commentSystems -}}
+ {{- if $pageCommentSystems.remark42 -}}
+ {{- with .remark42 -}}
+ {{- partial "remark42.html" . }}
+ {{- end -}}
+ {{- end -}}
+
+ {{- if $pageCommentSystems.telegramWidget -}}
+ {{- with .telegramWidget -}}
+ {{- partial "telegram_widget.html" . }}
+ {{- end -}}
+ {{- end -}}
-{{- with site.Params.commentSystem.disqus -}}
- {{- partial "disqus.html" . }}
+ {{- if $pageCommentSystems.disqus -}}
+ {{- with .disqus -}}
+ {{- partial "disqus.html" (dict "page" $page "disqus" .) }}
+ {{- end -}}
+ {{- end -}}
{{- end -}}