This repository has been archived on 2024-11-01. You can view files and clone it, but cannot push or open issues or pull requests.
blog/themes/kiera/layouts/partials/utterances.html

30 lines
1.2 KiB
HTML
Raw Permalink Normal View History

2024-10-28 16:26:25 -05:00
<section id="utterances"></section>
<script>
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
let s = document.createElement("script");
s.setAttribute("repo", "{{ .Site.Params.utterancesRepo }}");
s.src = "https://utteranc.es/client.js";
{{ with .Site.Params.utterancesIssueTerm }}
s.setAttribute("issue-term", "{{ . }}");
{{ end }}
{{ with .Site.Params.utterancesDarkTheme }}
s.setAttribute("theme", "{{ . }}")
{{ end }}
document.getElementById("utterances").innerHTML = "";
document.getElementById("utterances").appendChild(s);
} else {
let s = document.createElement("script");
s.setAttribute("repo", "{{ .Site.Params.utterancesRepo }}");
s.src = "https://utteranc.es/client.js";
{{ with .Site.Params.utterancesIssueTerm }}
s.setAttribute("issue-term", "{{ . }}");
{{ end }}
{{ with .Site.Params.utterancesLightTheme }}
s.setAttribute("theme", "{{ . }}")
{{ end }}
document.getElementById("utterances").innerHTML = "";
document.getElementById("utterances").appendChild(s);
}
</script>