Skip to content

Instantly share code, notes, and snippets.

@arjunkomath
Created November 26, 2022 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arjunkomath/49c4c136babd32f330f7d224ce4798cd to your computer and use it in GitHub Desktop.
Save arjunkomath/49c4c136babd32f330f7d224ce4798cd to your computer and use it in GitHub Desktop.
Setup comments in ghost blog
<script>
try {
let commentsContainerSelector = ".gh-content";
if (document.querySelector(commentsContainerSelector)) {
const commentsEl = document.createElement("script");
commentsEl.src = "https://utteranc.es/client.js";
commentsEl.setAttribute("repo", "github-username/repo-name");
commentsEl.setAttribute("issue-term", "pathname");
commentsEl.setAttribute("theme", "preferred-color-scheme");
commentsEl.setAttribute("crossorigin", "anonymous");
commentsEl.async = true;
document.querySelector(commentsContainerSelector).appendChild(commentsEl);
}
} catch (e) {
console.error("Failed to load comments", e);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment