Skip to content

Commit

Permalink
feat: add support for comment systems
Browse files Browse the repository at this point in the history
  • Loading branch information
apvarun committed Jan 9, 2023
1 parent 0c7ff54 commit 8e57fc5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All the changes made to Blist theme for Hugo.

## v2.1.0 - 2023-01-09

### Added

- Support multiple comment systems #64

## v2.0.1 - 2022-12-27

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Blist is a clean and fast blog theme for your Hugo site.

- Responsive content / Mobile-optimized
- Blog pagination
- Text Search
- Customizable Text Search
- Table of contents
- Social links
- Code highlighting
Expand All @@ -21,6 +21,10 @@ Blist is a clean and fast blog theme for your Hugo site.
- Fast performance
- SEO optimized
- i18n support
- Support comments systems
- Disqus (hugo native)
- giscus
- utterances

## Preview

Expand Down
23 changes: 23 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,29 @@ DefaultContentLanguageInSubdir = true
# This setting can also be in page's markdown file
hidePageThumbnail = false

# Comments system
[params.comments]
# Supports disqus, giscus and utterances
# Check hugo docs for setting up disqus
system = "giscus"

# Options for giscus, exclude hyphens
repo = ""
repoid = ""
category = ""
categoryid = ""
mapping = ""
strict = ""
reactionsenabled = ""
emitmetadata = ""
inputposition = ""
theme = ""

# Options for utterances, exclude hyphens
# repo = ""
# issueterm = ""
# theme = ""

[params.homepage.social]
# Global params common for both languages
title = "Follow me"
Expand Down
2 changes: 2 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,7 @@ <h5 class="text-sm flex items-center flex-wrap">
{{ .Content }}
</article>

{{- partial "comments.html" . -}}

{{- partial "social.html" . -}}
{{ end }}
31 changes: 31 additions & 0 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{ if .Site.Params.comments.system }}
<div class="px-2 mb-2">
{{ if eq .Site.Params.comments.system "disqus" }}
{{ template "_internal/disqus.html" . }}
{{ else if eq .Site.Params.comments.system "giscus" }}
<script src="https://giscus.app/client.js"
data-repo="{{ .Site.Params.comments.repo }}"
data-repo-id="{{ .Site.Params.comments.repoid }}"
data-category="{{ .Site.Params.comments.category }}"
data-category-id="{{ .Site.Params.comments.categoryid }}"
data-mapping="{{ default "pathname" .Site.Params.comments.mapping }}"
data-strict="{{ default "0" .Site.Params.comments.strict }}"
data-reactions-enabled="{{ default "1" .Site.Params.comments.reactionsenabled }}"
data-emit-metadata="{{ default "0" .Site.Params.comments.emitmetadata }}"
data-input-position="{{ default "bottom" .Site.Params.comments.inputposition }}"
data-theme="{{ default "preferred_color_scheme" .Site.Params.comments.theme }}"
data-lang="{{ default "en" $.Site.Language.Lang }}"
crossorigin="anonymous"
async>
</script>
{{ else if eq .Site.Params.comments.system "utterances" }}
<script src="https://utteranc.es/client.js"
repo="{{ .Site.Params.comments.repo }}"
issue-term="{{ default "pathname" .Site.Params.comments.issueterm }}"
theme="{{ default "preferred_color_scheme" .Site.Params.comments.theme }}"
crossorigin="anonymous"
async>
</script>
{{ end }}
</div>
{{ end }}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blist",
"version": "2.0.1",
"version": "2.1.0",
"description": "Blist is a clean and fast blog theme for your Hugo site.",
"main": "index.js",
"repository": "https://github.com/apvarun/blist-hugo-theme",
Expand Down

0 comments on commit 8e57fc5

Please sign in to comment.