feat(comments): add Cusdis support (#372)

* feat: add cusdis support

* docs: add cusdis example config
This commit is contained in:
WingLim 2021-10-01 22:38:37 +08:00 committed by GitHub
parent 57bfea8338
commit d8c9468c68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -121,6 +121,10 @@ params:
repo:
clientID:
clientSecret:
cusdis:
host:
id:
widgets:
enabled:

View file

@ -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>