From 9dd3a8ac58e1d5ce8018de423cdc20583c4336ea Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 21 Aug 2023 16:42:59 -0500 Subject: [PATCH] add comments via utterances --- config/_default/params.toml | 6 ++++++ content/about.md | 1 + layouts/_default/single.html | 9 +++++++++ layouts/partials/comments.html | 12 ++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 layouts/partials/comments.html diff --git a/config/_default/params.toml b/config/_default/params.toml index cba1808..b49fefa 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -4,6 +4,12 @@ description = "while (true) { bugs++; }" mainSections = ["posts"] fallBackOgImage = "images/broken-computer.svg" +# Comments +comments = true +utterancesRepo = "jbowdre/runtimeterror" +utterancesIssueTerm = "title" +utterancesTheme = "gruvbox-dark" + [theme] palette = "runtimeterror" diff --git a/content/about.md b/content/about.md index 229ea9a..b08b449 100644 --- a/content/about.md +++ b/content/about.md @@ -5,6 +5,7 @@ date = "2019-02-28" aliases = ["about-us", "about-hugo", "contact"] author = "Hugo Authors" timeless = "true" +comments = false +++ Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e4c856b..a5bce5e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -20,6 +20,15 @@
{{ .Content }}
+ {{- $showComments := true }} + {{- if eq .Site.Params.comments false }} + {{- $showComments = false }} + {{- else if eq .Params.comments false }} + {{- $showComments = false }} + {{- end }} + {{- if ne $showComments false }} + {{- partial "comments" . }} + {{- end }} {{ end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..66fadd5 --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,12 @@ +{{ if .Site.Params.utterancesRepo }} +
+
+ +
+{{ end }} \ No newline at end of file