This is the third tutorial on building your own blog system, focusing on adding a comment system.
During the blog setup process, a good comment system can greatly enhance interactivity. Today, I will introduce how to integrate Giscus, an open-source comment system based on GitHub Discussions, into a Hugo blog.
Why Choose Giscus?
🚀 No server required, based on GitHub Discussions
🔒 Secure and reliable, comment data is stored on GitHub
🧩 Supports dark mode and adaptive themes
💬 Supports anonymous comments (optional)
🌍 Multi-language interface support
Preparation
Before you start, you need:
A repository hosted on GitHub
Discussions feature enabled
A Hugo blog (any theme will do)
Step 1: Enable GitHub Discussions
Open your blog’s code repository (e.g., username/blog).
Here you need to remember the three parameters: data-repo, data-repo-id, and data-category-id, which will be used in the following configuration.
Step 3: Integrate Giscus into Your Hugo Theme
The theme I am using is hugo-narrow, which integrates the Giscus comment system, and you just need to do a little configuration. Here is my configuration:
Note that you need to replace repo, repoId, and categoryId with the values saved in Step 2. This is necessary for comments to display correctly.
Also, ensure that enabled is configured as true and system is set to giscus. Otherwise, comments will not show.
Finally, you will see an interface like this at the bottom of the article:
Testing
You can comment on this article and see if the comments display correctly. The comments can be checked in the GitHub Discussions.
For example, you can view the comments on my blog here.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.
Comments