Hugo-theme-stack/layouts/partials/comments/provider/utterances.html
Jimmy Cai 84dd80959a
fix: make Disqus / Utterances follow the global color scheme (#111)
* fix: make Disqus / Utterances follow the global color scheme

* fix: check if DISQUS exists before executing DISQUS.reset

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/107
2021-01-01 13:32:19 +01:00

31 lines
882 B
HTML

<script src="https://utteranc.es/client.js"
repo="{{ .Site.Params.comments.utterances.repo }}"
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
theme="{{ .Site.Params.comments.utterances.theme }}"
{{ with .Site.Params.comments.utterances.label }}
label="{{ . }}"
{{ end }}
crossorigin="anonymous"
async>
</script>
<style>
.utterances {
max-width: unset;
}
</style>
<script>
window.addEventListener('onColorSchemeChange', (e) => {
let utterances = document.querySelector('.utterances iframe');
if (utterances) {
utterances.contentWindow.postMessage(
{
type: 'set-theme',
theme: `github-${e.detail}`
},
'https://utteranc.es'
);
}
})
</script>