Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
exampleSite/Makefile
*~
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{{ .Content }}
</div>

{{ template "_internal/disqus.html" . }}
{{ partial "comments.html" . }}
{{ end }}
61 changes: 61 additions & 0 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{ if and .Site.DisqusShortname }}
<article class="comments">
{{ template "_internal/disqus.html" . }}
</article>
{{ else if .Site.Params.isso }}
<article class="comments">
<script
data-isso="{{ .Site.Params.isso.data }}"
{{ if .Site.Params.isso.id }}
data-isso-id="{{ .Site.Params.isso.id}}"
{{ end }}
{{ if .Site.Params.isso.css }}
data-isso-css="{{ .Site.Params.isso.css }}"
{{ end}}
{{ if .Site.Params.isso.lang }}
data-isso-lang="{{ .Site.Params.isso.lang }}"
{{ end }}
{{ if .Site.Params.isso.replyToSelf }}
data-isso-reply-to-self="{{ .Site.Params.isso.replyToSelf }}"
{{ end }}
{{ if .Site.Params.isso.requireAuthor }}
data-isso-require-author="{{ .Site.Params.isso.requireAuthor }}"
{{ end }}
{{ if .Site.Params.isso.requireEmail }}
data-isso-require-email="{{ .Site.Params.isso.requireEmail }}"
{{ end }}
{{if .Site.Params.isso.avatar }}
data-isso-avatar="{{ .Site.Params.isso.avatar }}"
{{ end }}
{{ if .Site.Params.isso.avararBg }}
data-isso-avatar-bg="{{ .Site.Params.isso.avatarBg }}"
{{ end }}
src="{{ .Site.Params.isso.jsLocation }}">
</script>
<noscript>Please enable JavaScript to view the comments powered by <a href="https://posativ.org/isso/">Isso</a>.</noscript>
<div>
<section id="isso-thread"></section>
</div>
</article>
{{ else if .Site.Params.utterances }}
<article class="comments">
<script src="https://utteranc.es/client.js"
repo="{{ .Site.Params.utterances.repo }}"
{{ if .Site.Params.utterances.issue }}
issue-term="{{ .Site.Params.utterances.issue }}"
{{ else }}
issue-term="pathname"
{{ end }}
{{ if .Site.Params.utterances.label }}
label="{{ .Site.Params.utterances.label }}"
{{ end }}
{{ if .Site.Params.utterances.theme }}
theme="{{ .Site.Params.utterances.theme }}"
{{ else }}
theme="github-light"
{{ end }}
crossorigin="anonymous"
async>
</script>
</article>
{{ end }}
2 changes: 1 addition & 1 deletion layouts/post/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ <h5>{{ .Params.Subtitle }}</h5>
</article>
</div>

{{ template "_internal/disqus.html" . }}
{{ partial "comments.html" . }}
{{ end }}