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

github.com/WingLim/hugo-tania.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWingLim <643089849@qq.com>2021-09-25 10:16:54 +0300
committerGitHub <noreply@github.com>2021-09-25 10:16:54 +0300
commita6732377e952ee774d07dea8447a822631f89012 (patch)
treed1aa0b45a4db412533fb65ba78f751c38154f635
parent628a0bebda24b9004ca8415e5f155e99e3ea4262 (diff)
feat(comments): add Cusdis support (#43)
* feat(comments): add Cusdis support * feat: set cusdis theme
-rw-r--r--assets/sass/components/_comments.scss4
-rw-r--r--layouts/partials/comments/provider/cusdis.html19
2 files changed, 23 insertions, 0 deletions
diff --git a/assets/sass/components/_comments.scss b/assets/sass/components/_comments.scss
index b6839f4..edbd965 100644
--- a/assets/sass/components/_comments.scss
+++ b/assets/sass/components/_comments.scss
@@ -1,3 +1,7 @@
.disqus-container {
padding-top: 2rem;
+}
+
+#cusdis_thread {
+ padding-top: 2rem;
} \ No newline at end of file
diff --git a/layouts/partials/comments/provider/cusdis.html b/layouts/partials/comments/provider/cusdis.html
new file mode 100644
index 0000000..246ff88
--- /dev/null
+++ b/layouts/partials/comments/provider/cusdis.html
@@ -0,0 +1,19 @@
+<div id="cusdis_thread" data-host="https://cusdis.com"
+ 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