Integrate
One line
html
<div id="comments"></div>
<script src="https://comments.example.com/embed.js" data-server="https://comments.example.com" defer></script>The script reads data-server and mounts into #comments. post defaults to location.pathname, normalized the same way the server does.
Explicit mount
html
<div id="comments"></div>
<script src="https://comments.example.com/embed.js" defer></script>
<script>
window.__gitCommentsAutoload = false
window.addEventListener('DOMContentLoaded', () => {
new Comments({
server: 'https://comments.example.com',
post: 'posts/hello-world',
mount: '#comments',
})
})
</script>Hugo
html
<div id="comments"></div>
<script src="https://comments.example.com/embed.js"
data-server="https://comments.example.com"
data-post="{{ .File.TranslationBaseName }}"
defer></script>Hexo
Add the same snippet to the post template and pass page.path as data-post.
Astro
astro
<div id="comments"></div>
<script is:inline src="https://comments.example.com/embed.js"
data-server="https://comments.example.com"
data-post={Astro.url.pathname} defer></script>Notes
serveris the only required option; the widget never sees your repository or token- Styles live in Shadow DOM, isolated in both directions
- Drafts (name, email, content) stay in localStorage and are cleared after a successful submit