From c0e180a37ed25b0efe14fafe58dbad595a10de06 Mon Sep 17 00:00:00 2001
From: Xen-Echo <67518109+Xen-Echo@users.noreply.github.com>
Date: Thu, 11 Mar 2021 19:24:08 +0000
Subject: [PATCH] Implemented per page comment disabling using the page Front Matter. (#150)
---
layouts/_default/single.html | 2 +-
README.md | 7 +++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/README.md b/README.md
index 0eb3ba4..85248dc 100644
--- a/README.md
+++ b/README.md
@@ -231,9 +231,16 @@
theme= "preferred-color-scheme"
# label =
```
+
Two notes on the security of Utteranc.es
- If you are using a strict CSP, you'll have to add the domain to it.
- The script currently has no built-in integrity check, due to limitations of [Utterances](https://github.com/utterance/utterances/issues/40).
+
+### Disabling Comments Per Page
+
+Comments can be disabled per page by setting `disableComments: true` on the pages [Front Matter](https://gohugo.io/content-management/front-matter/)
+
+
### Google Analytics
To use Google Analytics, a valid tracking code has to be added. If you don't want to load the code, then commend out the parameter.
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index b4ff807..baa8371 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -33,7 +33,7 @@
</div>
</div>
- {{ if eq .Type "post"}}
+ {{ if and (eq .Type "post") (ne .Page.Params.disableComments true) }}
{{- if .Site.DisqusShortname -}}
<div id="fb_comments_container">
<h2>{{ i18n "comments" }}</h2>
--
Gitblit v1.10.0