diff --git a/.gitignore b/.gitignore index 0163bc15..b0118bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ exampleSite/Makefile +*~ diff --git a/README.md b/README.md index de808807..ed1f0edd 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,38 @@ copyright = "© Copyright Year, Your Name" href = "" ``` +#### Comments +This theme supports comments with [Disqus](https://disqus.com), [Isso](https://posativ.org/isso) and [utterances](https://utteranc.es/). +Disqus is a fully provided comment solutionm although the free tier is add supported. +Isso is a lightweight, self-hosted server similar to disqus. +Utterances is a comment widget leveraging Github issues for comments. +Following are code snippets to enable each comment section. + +##### Disqus +```toml +disqusShortname = "my-disqus-shortname" +``` +##### Isso +Be sure to allow CORS on your server hosting the hugo site if the domain hosting isso is different to the domain hosting the hugo site. +```toml +data = "https://comments.example.com/" +jsLocation = "https://comments.example.com/js/embed.min.js" +id = "thread-id" #optional +css = true #optional +lang = "en" #optional +replyToSelf = true #optional +requireAuthor = false #optional +requireEmail = false #optional +avatar = true #optional +avatar-bg = "#f0f0f0" #optional +``` +##### utterances +```toml +[params.utterances] +repo = "GithubUser/comment-repo" +issue = "pathname" #optional +theme = "github-light" #optional +``` ### Updating To get updates to the theme, run the following from the root directory of your Hugo site: diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 146c5c19..ecb5da2f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -3,5 +3,5 @@ {{ .Content }} - {{ template "_internal/disqus.html" . }} + {{ partial "comments.html" . }} {{ end }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 00000000..198a8b7a --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,61 @@ +{{ if and .Site.DisqusShortname }} +
+ {{ template "_internal/disqus.html" . }} +
+{{ else if .Site.Params.isso }} +
+ + +
+
+
+
+{{ else if .Site.Params.utterances }} +
+ +
+{{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html index 787d83c1..56dd60ad 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -13,5 +13,5 @@
{{ .Params.Subtitle }}
- {{ template "_internal/disqus.html" . }} + {{ partial "comments.html" . }} {{ end }}