From 67f23a639f1c84dfb4178e8d4062d89fcd580189 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Tue, 05 Jan 2021 10:45:04 +0000
Subject: [PATCH] Merge pull request #109 from lxndrblz/utterances
---
layouts/_default/single.html | 6 ++++++
layouts/partials/comments/utterances.html | 10 ++++++++++
assets/css/style.css | 4 ++++
README.md | 18 ++++++++++++++++--
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 621fe74..df5e193 100644
--- a/README.md
+++ b/README.md
@@ -18,8 +18,8 @@
- Multilingual
- 100⁄100 Google Lighthouse score
- Google Analytics (optional)
+- Comments powered by Disqus or Utteranc.es (optional)
- SimpleAnalytics (optional)
-- Comments powered by Disqus (optional)
- Katex support (optional)
- Formspree Contact Form (optional)
- Twitter Cards support
@@ -205,12 +205,26 @@
### Comments powered by Disqus
-No comment section is shown on the `single.html`, unless a disqus code is specified in the `config.toml` file.
+No comment section is shown on the `single.html`, unless a Disqus code is specified in the `config.toml` file.
```toml
disqusShortname = "XXX"
```
+### Comments powered by Utteranc.es
+
+No comment section is shown on the `single.html`, unless a `repo` is specified in the `config.toml` file. If uncertain how parameter to configure, check out the official [documentation}(https://utteranc.es/).
+
+```toml
+[params.utterances]
+repo = "githubuser/reponame"
+issueTerm = "pathname"
+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 .
### 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/assets/css/style.css b/assets/css/style.css
index 8b2118c..01ce335 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -698,6 +698,10 @@
margin: 30px;
}
+.utterances {
+ max-width: unset;
+}
+
/* Buttons */
a.btn {
color: #868686;
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 08a68ed..0773a1e 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -37,6 +37,12 @@
{{ template "_internal/disqus.html" . }}
</div>
{{- end }}
+ {{ if .Site.Params.utterances.repo -}}
+ <div id="fb_comments_container">
+ <h2>{{ i18n "comments" }}</h2>
+ {{ partial "comments/utterances.html" . }}
+ </div>
+ {{- end }}
{{ end }}
</div>
diff --git a/layouts/partials/comments/utterances.html b/layouts/partials/comments/utterances.html
new file mode 100644
index 0000000..f17a592
--- /dev/null
+++ b/layouts/partials/comments/utterances.html
@@ -0,0 +1,10 @@
+<script src="https://utteranc.es/client.js"
+ repo="{{ .Site.Params.utterances.repo }}"
+ issue-term="{{ .Site.Params.utterances.issueTerm }}"
+ theme="{{ .Site.Params.utterances.theme }}"
+ {{ with .Site.Params.utterances.label }}
+ label="{{ . }}"
+ {{ end }}
+ crossorigin="anonymous"
+ async>
+</script>
\ No newline at end of file
--
Gitblit v1.10.0