mirror of https://github.com/lxndrblz/anatole.git

Alexander Bilz
05.45.2021 67f23a639f1c84dfb4178e8d4062d89fcd580189
Merge pull request #109 from lxndrblz/utterances

Added support for Utteranc.es comments
3 files modified
1 files added
38 ■■■■■ changed files
README.md 18 ●●●● patch | view | raw | blame | history
assets/css/style.css 4 ●●●● patch | view | raw | blame | history
layouts/_default/single.html 6 ●●●●● patch | view | raw | blame | history
layouts/partials/comments/utterances.html 10 ●●●●● patch | view | raw | blame | history
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 ![Uutterances](https://github.com/utterance/utterances/issues/40).
### 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.
assets/css/style.css
@@ -698,6 +698,10 @@
    margin: 30px;
}
.utterances {
    max-width: unset;
}
/* Buttons */
a.btn {
    color: #868686;
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>
layouts/partials/comments/utterances.html
New file
@@ -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>