diff options
author | Chen Xianmin <xianmin12@gmail.com> | 2022-09-07 15:21:02 +0300 |
---|---|---|
committer | Chen Xianmin <xianmin12@gmail.com> | 2022-09-07 15:21:02 +0300 |
commit | c6ef58996189bcafef0c5377ed18141a2338eed1 (patch) | |
tree | 855f5bcc1b878a4280bb526e49a0a142e9e508a8 | |
parent | b4e53196ce61e54096d6e1d034def89ff48e3323 (diff) |
feat: giscus comment system support
see: https://giscus.app
-rw-r--r-- | dev-config.toml | 17 | ||||
-rw-r--r-- | exampleSite/full-config.toml | 21 | ||||
-rw-r--r-- | layouts/partials/comments.html | 5 | ||||
-rw-r--r-- | layouts/partials/comments/giscus.html | 21 |
4 files changed, 57 insertions, 7 deletions
diff --git a/dev-config.toml b/dev-config.toml index 95f97aa..fc582e5 100644 --- a/dev-config.toml +++ b/dev-config.toml @@ -161,11 +161,26 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling slideout = '<script src="https://cdn.jsdelivr.net/npm/slideout@1.0.1/dist/slideout.min.js" integrity="sha256-t+zJ/g8/KXIJMjSVQdnibt4dlaDxc9zXr/9oNPeWqdg=" crossorigin="anonymous"></script>' [params.utteranc] # utteranc is a comment system based on GitHub issues. see https://utteranc.es - enable = true + enable = false repo = "xianmin/comments-for-hugo-theme-jane" # The repo to store comments issueTerm = "pathname" theme = "github-light" # theme: github-light, github-dark, github-dark-orange, icy-dark, dark-blue, photon-dark + [params.giscus] # giscus is a comment system based on GitHub Discussions. see https://giscus.app + enable = true + repo = "xianmin/comments-for-hugo-theme-jane" + repoId = "MDEwOlJlcG9zaXRvcnkxNDAyNDYzNjc=" + category = "Announcements" + categoryId = "DIC_kwDOCFv9X84CRRWF" + # mapping = "pathname" # comment value is the default value + # strict = 0 + # reactionsEnabled = 1 + # emitMetadata = 0 + # inputPosition = "top" + # theme = "light" + # lang = "en" + # lazyLoading = false + [params.search.google] # google custom search, see https://cse.google.com enable = true id = "002186711602136249422:q1gkomof_em" diff --git a/exampleSite/full-config.toml b/exampleSite/full-config.toml index 1535174..6fd35fc 100644 --- a/exampleSite/full-config.toml +++ b/exampleSite/full-config.toml @@ -138,17 +138,26 @@ defaultContentLanguage = "en" # Default language to use photoswipeCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.css" integrity="sha256-SBLU4vv6CA6lHsZ1XyTdhyjJxCjPif/TRkjnsyGAGnE=" crossorigin="anonymous">' photoswipeSKIN = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css" integrity="sha256-c0uckgykQ9v5k+IqViZOZKc47Jn7KQil4/MP3ySA3F8=" crossorigin="anonymous">' + [params.giscus] # giscus is a comment system based on GitHub Discussions. see https://giscus.app + enable = true + repo = "xianmin/comments-for-hugo-theme-jane" + repoId = "MDEwOlJlcG9zaXRvcnkxNDAyNDYzNjc=" + category = "Announcements" + categoryId = "DIC_kwDOCFv9X84CRRWF" + # mapping = "pathname" # comment value is the default value + # strict = 0 + # reactionsEnabled = 1 + # emitMetadata = 0 + # inputPosition = "top" + # theme = "light" + # lang = "en" + # lazyLoading = false + [params.utteranc] # utteranc is a comment system based on GitHub issues. see https://utteranc.es enable = false repo = "xianmin/comments-for-hugo-theme-jane" # The repo to store comments issueTerm = "pathname" - [params.gitment] # Gitment is a comment system based on GitHub issues. see https://github.com/imsun/gitment - owner = "" # Your GitHub ID - repo = "" # The repo to store comments - clientId = "" # Your client ID - clientSecret = "" # Your client secret - [params.commento] # Commento is a feature rich lightweight comment system oriented on privacy (https://commento.io/) enable = false url = "http://commento.example.com" diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index ad1a43e..1d3268f 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -5,6 +5,11 @@ {{ partial "comments/commento.html" . }} {{- end }} + <!-- giscus --> + {{ if .Site.Params.giscus.enable }} + {{ partial "comments/giscus.html" . }} + {{ end }} + <!-- utteranc --> {{ if .Site.Params.utteranc.enable }} {{ partial "comments/utteranc.html" . }} diff --git a/layouts/partials/comments/giscus.html b/layouts/partials/comments/giscus.html new file mode 100644 index 0000000..c5762a7 --- /dev/null +++ b/layouts/partials/comments/giscus.html @@ -0,0 +1,21 @@ +<div class="post bg-white"> + <script + src="https://giscus.app/client.js" + data-repo="{{ .Site.Params.giscus.repo }}" + data-repo-id="{{ .Site.Params.giscus.repoId }}" + data-category="{{ .Site.Params.giscus.category }}" + data-category-id="{{ .Site.Params.giscus.categoryId }}" + data-mapping="{{ .Site.Params.giscus.mapping | default `pathname` }}" + data-strict="{{ (string .Site.Params.giscus.strict) | default 0 }}" + data-reactions-enabled="{{ (string .Site.Params.giscus.reactionsEnabled) | default 1 }}" + data-emit-metadata="{{ (string .Site.Params.giscus.emitMetadata) | default 0 }}" + data-input-position="{{ .Site.Params.giscus.inputPosition | default `top` }}" + data-theme="{{ .Site.Params.giscus.theme | default `light` }}" + data-lang="{{ .Site.Params.giscus.lang | default `en` }}" + {{ if .Site.Params.giscus.lazyLoading }} + data-loading="lazy" + {{ end }} + crossorigin="anonymous" + async + ></script> +</div> |