fix(comments/cusdis): use the correct script for the self-hosted version (#403)
* Modify the Self-hosting js source path * refactor(comments/cusdis): avoid multiple if statement Co-authored-by: Jimmy Cai <github@jimmycai.com>
This commit is contained in:
parent
a7d316365c
commit
25581cc446
@ -1,14 +1,11 @@
|
|||||||
|
{{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}}
|
||||||
<div id="cusdis_thread"
|
<div id="cusdis_thread"
|
||||||
{{ if .Site.Params.comments.cusdis.host }}
|
data-host="{{ $host }}"
|
||||||
data-host="{{ .Site.Params.comments.cusdis.host }}"
|
|
||||||
{{ else }}
|
|
||||||
data-host="https://cusdis.com"
|
|
||||||
{{ end }}
|
|
||||||
data-app-id="{{ .Site.Params.comments.cusdis.id }}"
|
data-app-id="{{ .Site.Params.comments.cusdis.id }}"
|
||||||
data-page-id="{{ .File.UniqueID }}"
|
data-page-id="{{ .File.UniqueID }}"
|
||||||
data-page-url="{{ .Permalink }}"
|
data-page-url="{{ .Permalink }}"
|
||||||
data-page-title="{{ .Title }}"></div>
|
data-page-title="{{ .Title }}"></div>
|
||||||
<script async defer src="https://cusdis.com/js/cusdis.es.js"></script>
|
<script async defer src="{{ $host }}/js/cusdis.es.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function setCusdisTheme(theme) {
|
function setCusdisTheme(theme) {
|
||||||
@ -21,4 +18,4 @@
|
|||||||
window.addEventListener('onColorSchemeChange', (e) => {
|
window.addEventListener('onColorSchemeChange', (e) => {
|
||||||
setCusdisTheme(e.detail)
|
setCusdisTheme(e.detail)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user