Hugo-theme-stack/layouts/partials/comments/provider/utterances.html

31 lines
882 B
HTML
Raw Normal View History

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