Static site generators such as Hugo deliver speed, security, and simplicity by avoiding servers and databases. The challenge appears when you need a genuinely dynamic feature like user comments. This article explains how commenting systems fit into static sites, the common approaches, their trade-offs, and why the final solution—Hugo with Giscus—strikes an effective balance.


The Core Issue: Static Sites Don’t Handle Dynamic Data

Static sites pre-render HTML and serve it from a CDN or storage bucket. There’s no backend to:

  • store and retrieve comments
  • authenticate users
  • process submissions

Any commenting solution must provide these runtime capabilities externally, without breaking the static architecture. And personally, i don’t want to handle these myself.


Approaches to Add Comments

1. Hosted Comment Widgets

Examples: Disqus, Giscus, Utterances, Hyvor

These rely on embedded JavaScript widgets that load comments dynamically.
Pros: zero backend, quick setup, wide compatibility
Cons: depends on external service, potential privacy concerns (varies by provider)

2. GitHub/GitLab-Based Systems

Examples: Giscus, Utterances, Gitalk

They store comments as GitHub Discussions or Issues.
Pros: open-source, lightweight, OAuth support, excellent for technical audiences
Cons: requires GitHub login, stores comments publicly in the repo

3. Self-Hosted Backends

Examples: Isso, Commento (self-hosted)

Run your own minimal backend.
Pros: full data control, privacy-focused
Cons: maintenance required, separate hosting needed

4. Static Comments at Build Time

Example: Staticman

Generates Markdown files from comments. (Want to try next) Pros: comments become part of the site content
Cons: not realtime, rebuild required for every comment, more setup complexity


Why Choose Hugo + Giscus

Giscus uses GitHub Discussions as the storage layer and loads comments through a small JavaScript client. The site stays static while GitHub handles identity and data. And, my target audience generally has a github account.

Strengths

  • no backend to operate
  • no trackers or ads
  • fast and lightweight
  • open-source with transparent data storage
  • ideal fit for developer-oriented blogs
  • straightforward integration with Hugo

Limitations

  • commenters need GitHub accounts
  • comments are public in your GitHub Discussions
  • depends on GitHub’s uptime

Implementation Overview

The integration approach follows the workflow shown in:

General steps:

  1. Enable Discussions in your GitHub repo.
  2. Use https://giscus.app/ to generate the configuration script.
  3. Add the script to your Hugo single.html or a partial.
  4. Enable comments via frontmatter.

This keeps the site fully static while adding a reliable, modern commenting experience.


Summary

Static sites offer performance and simplicity, but they need external support for interactive features like comments. Among available techniques, GitHub-based systems seems to provide a clean solution without compromising the static architecture. Hugo paired with Giscus delivers a privacy-friendly, lightweight, and easy-to-maintain setup suited for technical audiences.

References