Skip to main content
  1. Personal Website/

How to Add a Giscus Comment System to a Hugo Blog

·237 words·1 min· loading · loading · ·
Fairchild
Author
Fairchild
A civil engineering guy who quit and ran.
14:30
Table of Contents
website - This article is part of a series.
Part 2: This Article

This article will introduce how to add a Giscus comment system to a Hugo - Blowfish theme blog.

In terms of theme and plugin ecosystem, community support, and documentation, Hugo lags behind Hexo.
Some Hugo themes come with built-in comment functionality. For example, Clean White currently supports Giscus, Disqus, and Twikoo comment systems.
Blowfish supports adding comments at the bottom of articles, but does not provide partial templates.

\blowfish\layouts\_default\single.html

0

Step 1: Install the giscus app for your Github account
#

https://giscus.app/

Step 2: Enabling github discussions for a repository
#

Step 3: Obtain Configuration Information
#

Step 4: Introduce Giscus into Blowfish
#

According to the Blowfish Theme Manual,

(1) A partial template layouts/partials/comments.html is required.

(2) Set [article] showComments = true globally in the params.toml configuration file, or set showComments : true individually in the title page parameters for each article. The default value of the title page parameters is inherited from the global parameters and can be modified individually.

Use the comments.html of the Clean White theme directly.

https://github.com/zhaohuabing/hugo-theme-cleanwhite/  

Similar to other third-party services, add giscus configuration information in params.toml.

[giscus]
  data_repo="username/repository"
  data_repo_id="****************" 
  data_category="Announcements"
  data_category_id="****************"
  data_mapping="pathname"
  data_strict="0"
  data_reactions_enabled="1"
  data_emit_metadata="0"
  data_input_position="bottom"
  data_theme="transparent_dark"
  data_lang="en"
  crossorigin="anonymous"
Tip
  • Note the code format; do not end with , or ;
  • Use underscores in comments.html; this must be consistent in params.toml
  • comments.html does not accept the parameter data_theme; you can change it.

Try it now!