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:
authorWingLim <643089849@qq.com>2021-10-01 17:38:37 +0300
committerGitHub <noreply@github.com>2021-10-01 17:38:37 +0300
commitd8c9468c685f38476b241f82130a6ae59e28ad05 (patch)
tree83e0ca94640b9de7727c8d4722e2b94c3e78b2f0
parent57bfea833850e0565cf81d9a26c52359427151a2 (diff)
feat(comments): add Cusdis support (#372)
* feat: add cusdis support * docs: add cusdis example config
-rw-r--r--exampleSite/config.yaml4
-rw-r--r--layouts/partials/comments/provider/cusdis.html24
2 files changed, 28 insertions, 0 deletions
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 7b89960..dcf6c63 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -121,6 +121,10 @@ params:
repo:
clientID:
clientSecret:
+
+ cusdis:
+ host:
+ id:
widgets:
enabled:
diff --git a/layouts/partials/comments/provider/cusdis.html b/layouts/partials/comments/provider/cusdis.html
new file mode 100644
index 0000000..71863f3
--- /dev/null
+++ b/layouts/partials/comments/provider/cusdis.html
@@ -0,0 +1,24 @@
+<div id="cusdis_thread"
+ {{ if .Site.Params.comments.cusdis.host }}
+ data-host="{{ .Site.Params.comments.cusdis.host }}"
+ {{ else }}
+ data-host="https://cusdis.com"
+ {{ end }}
+ data-app-id="{{ .Site.Params.comments.cusdis.id }}"
+ data-page-id="{{ .File.UniqueID }}"
+ data-page-url="{{ .Permalink }}"
+ data-page-title="{{ .Title }}"></div>
+<script async defer src="https://cusdis.com/js/cusdis.es.js"></script>
+
+<script>
+ function setCusdisTheme(theme) {
+ let cusdis = document.querySelector('#cusdis_thread iframe');
+ if (cusdis) {
+ window.CUSDIS.setTheme(theme)
+ }
+ }
+
+ window.addEventListener('onColorSchemeChange', (e) => {
+ setCusdisTheme(e.detail)
+ })
+</script> \ No newline at end of file