From 43fdd9cb18f5f3184c06176e1fbe80c9e65886fc Mon Sep 17 00:00:00 2001 From: Mivinci <1366723936@qq.com> Date: Wed, 9 Nov 2022 01:19:04 +0800 Subject: [PATCH] add support for giscus with an unsolved bug, good night :( --- exampleSite/config.yaml | 18 ++++++++++++++---- layouts/_default/single.html | 14 ++++++++++---- layouts/partials/giscus.html | 28 ++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 8 deletions(-) create mode 100644 layouts/partials/giscus.html diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 0b3d504..83b72c3 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -65,11 +65,21 @@ params: shortname: hugo-minima # utterances specifies the configuration for Utterances. - # What is Utterances? Check this out: https://utteranc.es + # Check out https://utteranc.es for the following three attributes. utterances: - repo: "mivinci/hugo-theme-minima" - issueTerm: "pathname" - label: "comment" + repo: mivinci/hugo-theme-minima + issueTerm: pathname + label: comment + + # giscus specifies the configuration for Giscus. + # Check out https://giscus.app for the following six attributes. + giscus: + repo: mivinci/hugo-theme-minima + repoId: MDEwOlJlcG9zaXRvcnkzODcxMjM2NDU= + category: Comments + categoryId: DIC_kwDOFxMJvc4CScQm + mapping: pathname + inputPostion: buttom # **DEPRECATED** # ovo(https://ovo.js.org) is a comment plugin written by the author of Minima but diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2942994..1e49849 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -35,17 +35,23 @@ {{ end }} {{ if or .Params.comment (and .Site.Params.commentOnAllPosts (ne .Params.comment false)) }} + {{ if eq .Site.Params.comment "disqus"}} {{ partial "disqus.html" . }} {{ end }} - {{ if eq .Site.Params.comment "ovo"}} - {{ partial "ovo.html" . }} - {{ end }} - {{ if eq .Site.Params.comment "utterances"}} {{ partial "utterances.html" . }} {{ end }} + + {{ if eq .Site.Params.comment "giscus" }} + {{ partial "giscus.html" }} + {{ end }} + + {{ if eq .Site.Params.comment "ovo"}} + {{ partial "ovo.html" . }} + {{ end }} + {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/giscus.html b/layouts/partials/giscus.html new file mode 100644 index 0000000..a32e484 --- /dev/null +++ b/layouts/partials/giscus.html @@ -0,0 +1,28 @@ + \ No newline at end of file