diff options
author | nyms7 <hi@nym.si> | 2024-05-06 15:19:49 +0800 |
---|---|---|
committer | nyms7 <hi@nym.si> | 2024-05-06 15:19:49 +0800 |
commit | b8fb7d7a8c8f3dfd7af148913993dd783684f5c8 (patch) | |
tree | 5e68ab2b64ad2375ea6207b5bdbfb9a442e5a6bb | |
parent | b273b8155ad919ddee562e48df2f2f29bd1ac6b4 (diff) |
feat: add giscus support
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | layouts/_default/single.html | 1 | ||||
-rw-r--r-- | layouts/partials/comments.html | 18 |
3 files changed, 29 insertions, 0 deletions
@@ -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 diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c0f41c5..420a8ba 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -43,6 +43,7 @@ <div class="single-content"> {{ .Content }} + {{ partial "comments.html" . }} </div> </div> diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..979b59e --- /dev/null +++ b/layouts/partials/comments.html @@ -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 }}
\ No newline at end of file |