feat: add giscus support

This commit is contained in:
nyms7 2024-05-06 15:19:49 +08:00
parent d005e677d9
commit ca11f2c2bb
3 changed files with 29 additions and 0 deletions

View file

@ -193,6 +193,16 @@ url = "/posts"
name = "resume"
url = "/resume"
# giscus conf, for more detail, see https://giscus.app/
[params.giscus]
enable = true
repo = ""
repoid = ""
category = ""
categoryid = ""
mapping = "pathname"
theme = "light"
# Syntax highlight on code blocks, all styles:
# https://xyproto.github.io/splash/docs/all.html
# I suggest algol

View file

@ -43,6 +43,7 @@
<div class="single-content">
{{ .Content }}
{{ partial "comments.html" . }}
</div>
</div>

View file

@ -0,0 +1,18 @@
{{ if .Site.Params.giscus.enable }}
<script src="https://giscus.app/client.js"
data-repo="{{ .Site.Params.giscus.repo }}"
data-repo-id="{{ .Site.Params.giscus.repoid }}"
data-category="{{ .Site.Params.utteranc.category }}"
data-category-id="{{ .Site.Params.giscus.categoryid }}"
data-mapping="{{ .Site.Params.giscus.mapping }}"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="{{ .Site.Params.giscus.theme }}"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
{{ end }}