Created
November 26, 2022 01:27
-
-
Save arjunkomath/49c4c136babd32f330f7d224ce4798cd to your computer and use it in GitHub Desktop.
Setup comments in ghost blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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