Skip to content

Commit

Permalink
feat(comments): add Cusdis support (#43)
Browse files Browse the repository at this point in the history
* feat(comments): add Cusdis support

* feat: set cusdis theme
  • Loading branch information
WingLim authored Sep 25, 2021
1 parent 628a0be commit a673237
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/sass/components/_comments.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.disqus-container {
padding-top: 2rem;
}

#cusdis_thread {
padding-top: 2rem;
}
19 changes: 19 additions & 0 deletions layouts/partials/comments/provider/cusdis.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit a673237

Please sign in to comment.