yarkov.tech/src/components/ArticleComments/ArticleComments.astro
2022-11-11 19:51:00 +03:00

30 lines
912 B
Plaintext

---
import UIString from "../UIString";
---
<footer>
<h2><UIString key={"articlePost.comments"} /></h2>
<div id="comments"></div>
</footer>
<script>
const $commentsWrapper = document.getElementById("comments");
const $commentsScript = document.createElement("script");
$commentsScript.async = true;
$commentsScript.src = "https://utteranc.es/client.js";
$commentsScript.setAttribute("repo", "sergeyyarkov/comments");
$commentsScript.setAttribute("issue-term", "title");
$commentsScript.setAttribute("label", "Comment");
$commentsScript.setAttribute("id", "utterances");
$commentsScript.setAttribute("crossorigin", "anonymous");
if (window.theme) {
$commentsScript.setAttribute("theme", window.theme === "dark" ? "dark-blue" : "github-light");
} else {
$commentsScript.setAttribute("theme", "github-light");
}
if ($commentsWrapper) $commentsWrapper.appendChild($commentsScript);
</script>