Skip to content

Commit 8e57fc5

Browse files
committed
feat: add support for comment systems
1 parent 0c7ff54 commit 8e57fc5

File tree

7 files changed

+70
-4
lines changed

7 files changed

+70
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All the changes made to Blist theme for Hugo.
44

5+
## v2.1.0 - 2023-01-09
6+
7+
### Added
8+
9+
- Support multiple comment systems #64
10+
511
## v2.0.1 - 2022-12-27
612

713
### Fixed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Blist is a clean and fast blog theme for your Hugo site.
1212

1313
- Responsive content / Mobile-optimized
1414
- Blog pagination
15-
- Text Search
15+
- Customizable Text Search
1616
- Table of contents
1717
- Social links
1818
- Code highlighting
@@ -21,6 +21,10 @@ Blist is a clean and fast blog theme for your Hugo site.
2121
- Fast performance
2222
- SEO optimized
2323
- i18n support
24+
- Support comments systems
25+
- Disqus (hugo native)
26+
- giscus
27+
- utterances
2428

2529
## Preview
2630

exampleSite/config.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,29 @@ DefaultContentLanguageInSubdir = true
140140
# This setting can also be in page's markdown file
141141
hidePageThumbnail = false
142142

143+
# Comments system
144+
[params.comments]
145+
# Supports disqus, giscus and utterances
146+
# Check hugo docs for setting up disqus
147+
system = "giscus"
148+
149+
# Options for giscus, exclude hyphens
150+
repo = ""
151+
repoid = ""
152+
category = ""
153+
categoryid = ""
154+
mapping = ""
155+
strict = ""
156+
reactionsenabled = ""
157+
emitmetadata = ""
158+
inputposition = ""
159+
theme = ""
160+
161+
# Options for utterances, exclude hyphens
162+
# repo = ""
163+
# issueterm = ""
164+
# theme = ""
165+
143166
[params.homepage.social]
144167
# Global params common for both languages
145168
title = "Follow me"

layouts/_default/single.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,7 @@ <h5 class="text-sm flex items-center flex-wrap">
6767
{{ .Content }}
6868
</article>
6969

70+
{{- partial "comments.html" . -}}
71+
7072
{{- partial "social.html" . -}}
7173
{{ end }}

layouts/partials/comments.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{{ if .Site.Params.comments.system }}
2+
<div class="px-2 mb-2">
3+
{{ if eq .Site.Params.comments.system "disqus" }}
4+
{{ template "_internal/disqus.html" . }}
5+
{{ else if eq .Site.Params.comments.system "giscus" }}
6+
<script src="https://giscus.app/client.js"
7+
data-repo="{{ .Site.Params.comments.repo }}"
8+
data-repo-id="{{ .Site.Params.comments.repoid }}"
9+
data-category="{{ .Site.Params.comments.category }}"
10+
data-category-id="{{ .Site.Params.comments.categoryid }}"
11+
data-mapping="{{ default "pathname" .Site.Params.comments.mapping }}"
12+
data-strict="{{ default "0" .Site.Params.comments.strict }}"
13+
data-reactions-enabled="{{ default "1" .Site.Params.comments.reactionsenabled }}"
14+
data-emit-metadata="{{ default "0" .Site.Params.comments.emitmetadata }}"
15+
data-input-position="{{ default "bottom" .Site.Params.comments.inputposition }}"
16+
data-theme="{{ default "preferred_color_scheme" .Site.Params.comments.theme }}"
17+
data-lang="{{ default "en" $.Site.Language.Lang }}"
18+
crossorigin="anonymous"
19+
async>
20+
</script>
21+
{{ else if eq .Site.Params.comments.system "utterances" }}
22+
<script src="https://utteranc.es/client.js"
23+
repo="{{ .Site.Params.comments.repo }}"
24+
issue-term="{{ default "pathname" .Site.Params.comments.issueterm }}"
25+
theme="{{ default "preferred_color_scheme" .Site.Params.comments.theme }}"
26+
crossorigin="anonymous"
27+
async>
28+
</script>
29+
{{ end }}
30+
</div>
31+
{{ end }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blist",
3-
"version": "2.0.1",
3+
"version": "2.1.0",
44
"description": "Blist is a clean and fast blog theme for your Hugo site.",
55
"main": "index.js",
66
"repository": "https://github.com/apvarun/blist-hugo-theme",

0 commit comments

Comments
 (0)