From 6a19ac31c0c6c401b50965d8efd58a272c127d7f Mon Sep 17 00:00:00 2001 From: Jinuk Im Date: Wed, 27 Sep 2023 04:47:22 +0900 Subject: [PATCH] feat: add giscus support (#92) * feat: add giscus support #89 * Update comment.html * Update giscus.html * Update giscus.html --------- Co-authored-by: Xin --- layouts/_default/list.html | 1 + layouts/_default/single.html | 1 + layouts/blog/single.html | 1 + layouts/docs/list.html | 1 + layouts/docs/single.html | 1 + layouts/partials/components/comment.html | 8 +++ layouts/partials/components/giscus.html | 62 ++++++++++++++++++++++++ 7 files changed, 75 insertions(+) create mode 100644 layouts/partials/components/comment.html create mode 100644 layouts/partials/components/giscus.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 9b58790e..2cd87af3 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -10,6 +10,7 @@

{{ .Title }}

{{ partial "components/last-updated.html" . }} + {{ partial "components/comment.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 25a5a293..11c3bc49 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -10,6 +10,7 @@

{{ .Content }} + {{ partial "components/comment.html" . }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html index dee6cb9b..c7059f50 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -28,6 +28,7 @@

diff --git a/layouts/docs/list.html b/layouts/docs/list.html index 8d1be7a0..d4e9bbc7 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -12,6 +12,7 @@

{{ .Title }}

{{ partial "components/last-updated.html" . }} {{ partial "components/pager.html" . }} + {{ partial "components/comment.html" . }} diff --git a/layouts/docs/single.html b/layouts/docs/single.html index da9b205b..81656b5b 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -11,6 +11,7 @@

{{ .Title }}

{{ partial "components/last-updated.html" . }} {{ partial "components/pager.html" . }} + {{ partial "components/comment.html" . }} diff --git a/layouts/partials/components/comment.html b/layouts/partials/components/comment.html new file mode 100644 index 00000000..cb95e7ec --- /dev/null +++ b/layouts/partials/components/comment.html @@ -0,0 +1,8 @@ +{{- $commentEnable := site.Params.comment.enable | default false -}} +{{- $commentPageEnable := .Params.comment | default true -}} + +{{- if and $commentEnable $commentPageEnable -}} + {{- if eq site.Params.comment.type "giscus" -}} + {{ partial "components/giscus.html" . }} + {{- end -}} +{{- end -}} diff --git a/layouts/partials/components/giscus.html b/layouts/partials/components/giscus.html new file mode 100644 index 00000000..1ea3dc87 --- /dev/null +++ b/layouts/partials/components/giscus.html @@ -0,0 +1,62 @@ +{{- with site.Params.comment.giscus -}} + +{{- $lang = site.Language.Lang | default `en` -}} + +
+{{- end -}}