Add option for giscus comment section (#309)

* add giscus option

* add giscus options to config.toml

* rm quotes around hugo code
This commit is contained in:
Athanasia Monika Mowinckel 2021-12-19 02:43:37 +01:00 committed by GitHub
parent 067768c63d
commit 8c3c9cedd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View file

@ -35,6 +35,21 @@ DefaultContentLanguage = "en" # Default language fo
facebook = true facebook = true
pinterest = true pinterest = true
# To enable giscus, the github discussions based comment section,
# Follow the steps described to enable giscus and get the values
# needed to populate the below information.
# https://www.joelnitta.com/posts/2021-11-24_using-giscus/
[params.giscus]
# repo = "github-user/github-repo" # Entering repo will enable giscus
repo-id = "enter-repo-id"
category = "Comments"
category-id = "enter-category-id"
mapping = "pathname"
reactions-enabled = "1"
emit-metadata = "0"
theme = "light"
lang = "en"
# Social icons appear in introduction and contact section. Add as many more as you like. # Social icons appear in introduction and contact section. Add as many more as you like.
# Icon pack "fab" includes social network icons, see: https://fontawesome.com/icons?d=gallery&s=brands&m=free # Icon pack "fab" includes social network icons, see: https://fontawesome.com/icons?d=gallery&s=brands&m=free
# Icon pack "fas" includes solid style icons, see: https://fontawesome.com/icons?d=gallery&s=solid&m=free # Icon pack "fas" includes solid style icons, see: https://fontawesome.com/icons?d=gallery&s=solid&m=free

View file

@ -3,3 +3,21 @@
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}
</div> </div>
{{- end }} {{- end }}
{{- if .Site.Params.giscus.repo }}
<div class="container giscus my-4">
<script src="https://giscus.app/client.js"
data-repo={{ .Site.Params.giscus.repo }}
data-repo-id={{ .Site.Params.giscus.repo_id }}
data-category={{ .Site.Params.giscus.category }}
data-category-id={{ .Site.Params.giscus.category_id }}
data-mapping={{ .Site.Params.giscus.mapping }}
data-reactions-enabled={{ .Site.Params.giscus.reactions_enabled | default 0}}
data-emit-metadata={{ .Site.Params.giscus.emit_metadata | default 0 }}
data-theme={{ .Site.Params.giscus.theme }}
data-lang={{ .Site.Params.giscus.lang }}
crossorigin="anonymous"
async>
</script>
</div>
{{- end }}