Giscus is a super lightweight comment system powered by GitHub Discussions. It uses a GitHub app plus a small JavaScript snippet to embed a comment section on your site. If someone comments, it automatically creates a GitHub Discussion and syncs replies. See the bottom of this post for a live example. There’s no backend, no database, and if your readers have a GitHub account, that’s all they need. Here’s how I integrated it into a Hugo site using the Docsy theme.
Enable Discussions in your repository:
<script>
block like this:<script src="https://giscus.app/client.js"
data-repo="[ENTER REPO HERE]"
data-repo-id="[ENTER REPO ID HERE]"
data-category="[ENTER CATEGORY NAME HERE]"
data-category-id="[ENTER CATEGORY ID HERE]"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
crossorigin="anonymous"
async>
</script>
Hang to this for the next step.
<script>
output.[params.giscus]
repo = ""
repo_id = ""
category_id = ""
category = "General"
mapping = "url"
theme = "preferred_color_scheme"
data_reactions = "1"
data_input_position="top"
<script>
:{{ if .Site.Params.giscus.repo }}
<div id="comments" style="margin-top: 2rem;">
<script src="https://giscus.app/client.js"
data-repo="{{ .Site.Params.giscus.repo }}"
data-repo-id="{{ .Site.Params.giscus.repo_id }}"
data-category="{{ default "General" .Site.Params.giscus.category }}"
data-category-id="{{ .Site.Params.giscus.category_id }}"
data-mapping="{{ default "url" .Site.Params.giscus.mapping }}"
data-strict="0"
data-reactions-enabled="{{ default "1" .Site.Params.giscus.data_reactions }}"
data-emit-metadata="0"
data-input-position="{{ default "top" .Site.Params.giscus.data_input_position }}"
data-theme="{{ default "preferred_color_scheme" .Site.Params.giscus.theme }}"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
</div>
{{ end }}
<div>
...
{{ if .IsPage }}
{{ partial "comments.html" . }}
{{ end }}
</div>
Push it, test it, and you should see the Giscus thread at the bottom of your posts. If a page hasn’t been commented on before, Giscus will create the discussion when someone does.
Try it out below!