From 02e057b3bc6a7870955d908d8c7789ba6ee9bc88 Mon Sep 17 00:00:00 2001 From: Yudy Chen Date: Sun, 22 Aug 2021 10:13:20 -0700 Subject: [PATCH] Added utteranc.es and Cactus Comments support --- exampleSite/config.toml | 12 +++++-- layouts/partials/comments.html | 34 ++++++------------- .../partials/comments/cactus_comments.html | 11 ++++++ layouts/partials/comments/disqus.html | 17 ++++++++++ layouts/partials/comments/utterances.html | 10 ++++++ layouts/partials/head.html | 2 ++ 6 files changed, 60 insertions(+), 26 deletions(-) create mode 100644 layouts/partials/comments/cactus_comments.html create mode 100644 layouts/partials/comments/disqus.html create mode 100644 layouts/partials/comments/utterances.html diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 97b3c21e..a57fbe91 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -70,8 +70,16 @@ weight = 4 showReadTime = true # default [params.comments] - enabled = false # default - engine = "disqus" # more supported engines will be added. + enabled = true # default + engine = "cactus_comments" # only disqus, utterances, and cactus_comments is supported + [params.comments.utterances] + repo = "/" + label = "hugo-site-name" # you can use however you want to label your name in your repo's issues + theme = "github-light" + [params.comments.cactuscomments] + siteName = "your_cactus_comments_sitename" # see https://cactus.chat/ on how to register your site name + #serverUrl = "" # Defaults to https://matrix.cactus.chat:8448 (Cactus Chat public server) + #serverName = "" # Defaults to cactus.chat # the value of name should be an valid font awesome icon name (brands type) # https://fontawesome.com/icons?d=gallery&s=brands diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index c3f88870..b17721e8 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -10,27 +10,13 @@ {{ $enable_comments := .Scratch.Get "enable_comments" }} {{ if $enable_comments }} - {{ if (or (not (isset .Site.Params.Comments "engine")) (eq .Site.Params.Comments.Engine "disqus")) }} -
-
- - - comments powered by Disqus -
-
- - {{ end }} -{{ end }} \ No newline at end of file +
+ {{ if (or (not (isset .Site.Params.Comments "engine")) (eq .Site.Params.Comments.Engine "disqus")) }} + {{ partial "comments/disqus.html" . }} + {{ else if eq .Site.Params.Comments.Engine "utterances" }} + {{ partial "comments/utterances.html" . }} + {{ else if eq .Site.Params.Comments.Engine "cactus_comments" }} + {{ partial "comments/cactus_comments.html" . }} + {{ end }} +
+{{ end }} diff --git a/layouts/partials/comments/cactus_comments.html b/layouts/partials/comments/cactus_comments.html new file mode 100644 index 00000000..7873bbb5 --- /dev/null +++ b/layouts/partials/comments/cactus_comments.html @@ -0,0 +1,11 @@ +
+ +
diff --git a/layouts/partials/comments/disqus.html b/layouts/partials/comments/disqus.html new file mode 100644 index 00000000..8acd459f --- /dev/null +++ b/layouts/partials/comments/disqus.html @@ -0,0 +1,17 @@ +
+ + + comments powered by Disqus +
diff --git a/layouts/partials/comments/utterances.html b/layouts/partials/comments/utterances.html new file mode 100644 index 00000000..205617ad --- /dev/null +++ b/layouts/partials/comments/utterances.html @@ -0,0 +1,10 @@ +
+ +
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 82ea9c32..90ef9277 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,6 +3,8 @@ + + {{ if .IsPage }} {{ .Title }} | {{ end }}{{ .Site.Title }}