From 28511efd081dba9dac8cbf8fa2c8135216264243 Mon Sep 17 00:00:00 2001 From: Reorx Date: Fri, 27 May 2022 21:33:40 +0800 Subject: [PATCH] control comment system in partials/comments.html --- layouts/_default/single.html | 2 +- layouts/partials/comments.html | 12 +++++++++--- layouts/partials/comments_js.html | 3 --- layouts/partials/comments_script.html | 5 +++++ layouts/partials/disqus.html | 3 +++ layouts/partials/disqus_script.html | 27 +++++++++++++++++++++++++++ layouts/partials/page_footer.html | 2 +- layouts/partials/telegram_widget.html | 7 +++++++ 8 files changed, 53 insertions(+), 8 deletions(-) delete mode 100644 layouts/partials/comments_js.html create mode 100644 layouts/partials/comments_script.html create mode 100644 layouts/partials/disqus.html create mode 100644 layouts/partials/disqus_script.html create mode 100644 layouts/partials/telegram_widget.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9b0a398..c71f66d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -46,7 +46,7 @@ {{- if not (.Param "noComments") }} - {{- partial "comments.html" . }} + {{- partial "comments.html" . }} {{- end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 918451a..a07744a 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,3 +1,9 @@ -{{- /* Comments area start */ -}} -{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}} -{{- /* Comments area end */ -}} +{{- /* You can add your own layouts/comments.html to override this file */ -}} + +{{- with site.Params.commentSystem.disqus -}} + {{- partial "disqus.html" . }} +{{- end -}} + +{{- with site.Params.commentSystem.telegramWidget -}} + {{- partial "telegram_widget.html" . }} +{{- end -}} diff --git a/layouts/partials/comments_js.html b/layouts/partials/comments_js.html deleted file mode 100644 index cca3404..0000000 --- a/layouts/partials/comments_js.html +++ /dev/null @@ -1,3 +0,0 @@ -{{- /* Comments js area start */ -}} -{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}} -{{- /* Comments js area end */ -}} diff --git a/layouts/partials/comments_script.html b/layouts/partials/comments_script.html new file mode 100644 index 0000000..8663497 --- /dev/null +++ b/layouts/partials/comments_script.html @@ -0,0 +1,5 @@ +{{- /* You can add your own layouts/comments_script.html to override this file */ -}} + +{{- with site.Params.commentSystem.disqus -}} + {{ partial "disqus_script.html" . }} +{{- end -}} diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html new file mode 100644 index 0000000..dc86fc2 --- /dev/null +++ b/layouts/partials/disqus.html @@ -0,0 +1,3 @@ +
+
+
diff --git a/layouts/partials/disqus_script.html b/layouts/partials/disqus_script.html new file mode 100644 index 0000000..4840d14 --- /dev/null +++ b/layouts/partials/disqus_script.html @@ -0,0 +1,27 @@ + diff --git a/layouts/partials/page_footer.html b/layouts/partials/page_footer.html index 589292b..2d0dd2a 100644 --- a/layouts/partials/page_footer.html +++ b/layouts/partials/page_footer.html @@ -126,5 +126,5 @@ {{- end }} {{- if not (.Param "noComments") }} - {{- partial "comments_js.html" . }} + {{- partial "comments_script.html" . }} {{ end }} diff --git a/layouts/partials/telegram_widget.html b/layouts/partials/telegram_widget.html new file mode 100644 index 0000000..84db442 --- /dev/null +++ b/layouts/partials/telegram_widget.html @@ -0,0 +1,7 @@ +{{- with site.Params.commentSystem.telegramWidget }} + +{{- end }}