From 96366c2b87ecaff6661dfcea56f5cccea7c85914 Mon Sep 17 00:00:00 2001 From: ahmedakef Date: Sat, 17 Dec 2022 21:50:41 +0200 Subject: [PATCH] support giscus --- layouts/_default/single.html | 5 +---- layouts/partials/comments.html | 22 -------------------- layouts/partials/comments/engine/cactus.html | 12 +++++++++++ layouts/partials/comments/engine/giscus.html | 15 +++++++++++++ layouts/partials/comments/entry_point.html | 14 +++++++++++++ 5 files changed, 42 insertions(+), 26 deletions(-) delete mode 100644 layouts/partials/comments.html create mode 100644 layouts/partials/comments/engine/cactus.html create mode 100644 layouts/partials/comments/engine/giscus.html create mode 100644 layouts/partials/comments/entry_point.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 8986471..433538c 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,8 +2,5 @@

{{ .Title }}

{{ .Content }} -
-
-

comments:

- {{ partial "comments.html" . }} + {{ partial "comments/entry_point.html" . }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html deleted file mode 100644 index 787f5b4..0000000 --- a/layouts/partials/comments.html +++ /dev/null @@ -1,22 +0,0 @@ -{{ if (isset .Site.Params.Comments "enabled") }} - {{ .Scratch.Set "enable_comments" .Site.Params.Comments.Enabled }} -{{ else }} - {{ .Scratch.Set "enable_comments" false }} -{{ end }} - - -{{ $enable_comments := .Scratch.Get "enable_comments" }} -{{ if $enable_comments }} - - -
- -{{ end }} diff --git a/layouts/partials/comments/engine/cactus.html b/layouts/partials/comments/engine/cactus.html new file mode 100644 index 0000000..3068acf --- /dev/null +++ b/layouts/partials/comments/engine/cactus.html @@ -0,0 +1,12 @@ + + +
+ \ No newline at end of file diff --git a/layouts/partials/comments/engine/giscus.html b/layouts/partials/comments/engine/giscus.html new file mode 100644 index 0000000..91b68a6 --- /dev/null +++ b/layouts/partials/comments/engine/giscus.html @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/layouts/partials/comments/entry_point.html b/layouts/partials/comments/entry_point.html new file mode 100644 index 0000000..9493eed --- /dev/null +++ b/layouts/partials/comments/entry_point.html @@ -0,0 +1,14 @@ +{{ if (isset .Site.Params.Comments "enabled") }} + {{ .Scratch.Set "enable_comments" .Site.Params.Comments.Enabled }} +{{ else }} + {{ .Scratch.Set "enable_comments" false }} +{{ end }} + + +{{ $enable_comments := .Scratch.Get "enable_comments" }} +{{ if $enable_comments }} +
+
+

comments:

+ {{ partial (printf "comments/engine/%s" .Site.Params.comments.engine) . }} +{{ end }}