Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel <MTRNord@users.noreply.github.com>2022-01-23 15:10:00 +0300
committerGitHub <noreply@github.com>2022-01-23 15:10:00 +0300
commit7dc5def2175fbd5021f0109af25202fbb7567757 (patch)
tree5e12358528fdfbb89a703d0ab60a044991b24ace
parent2b40a32d4785ab3c3d12a09ea8a136b1522deabe (diff)
feat(comments): add https://cactus.chat support (#298)
* feat: Add https://cactus.chat as comments provider * Add cactus comments config fields to exampleSite * Add cactus css and js to external.yaml and move custom cactus css to html * Remove unneeded cactus comments css * Load external dependencies for cactus comments in the comments provider * Use safeJS instead of safeHTML
-rw-r--r--data/external.yaml9
-rw-r--r--exampleSite/config.yaml7
-rw-r--r--layouts/partials/comments/provider/cactus.html29
3 files changed, 44 insertions, 1 deletions
diff --git a/data/external.yaml b/data/external.yaml
index 427c8aa..4b2713f 100644
--- a/data/external.yaml
+++ b/data/external.yaml
@@ -36,3 +36,12 @@ KaTeX:
integrity: sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl
type: script
defer: true
+
+Cactus:
+ - src: https://latest.cactus.chat/cactus.js
+ integrity:
+ type: script
+ defer: false
+ - src: https://latest.cactus.chat/style.css
+ integrity:
+ type: style \ No newline at end of file
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 28958ae..a67b4aa 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -104,6 +104,12 @@ params:
path:
lang:
+ # See https://cactus.chat/docs/reference/web-client/#configuration for description of the various options
+ cactus:
+ defaultHomeserverUrl: "https://matrix.cactus.chat:8448"
+ serverName: "cactus.chat"
+ siteName: "" # You must insert a unique identifier here matching the one you registered (See https://cactus.chat/docs/getting-started/quick-start/#register-your-site)
+
giscus:
repo:
repoID:
@@ -125,7 +131,6 @@ params:
cusdis:
host:
id:
-
widgets:
enabled:
- search
diff --git a/layouts/partials/comments/provider/cactus.html b/layouts/partials/comments/provider/cactus.html
new file mode 100644
index 0000000..8224c8b
--- /dev/null
+++ b/layouts/partials/comments/provider/cactus.html
@@ -0,0 +1,29 @@
+{{- with .Site.Params.comments.cactus -}}
+{{- partial "helper/external" (dict "Context" . "Namespace" "Cactus") -}}
+
+<style>
+ .cactus-editor-textarea {
+ color: var(--body-text-color);
+ }
+
+ .cactus-comment-header {
+ color: var(--card-text-color-main);
+ }
+
+ .cactus-message-text > p {
+ color: var(--body-text-color);
+ }
+</style>
+
+<div id="comment-section"></div>
+
+<script>
+ initComments({
+ node: document.getElementById("comment-section"),
+ defaultHomeserverUrl: "{{ .defaultHomeserverUrl | safeJS }}",
+ serverName: "{{ .serverName }}",
+ siteName: "{{ .siteName }}",
+ commentSectionId: "{{ $.File.UniqueID }}"
+ })
+</script>
+{{- end -}}