It's been three years since I started this blog using Hugo and GitHub pages, but I never enabled comments since this blog makes use of static pages, some users commented my posts using github issues and I thought it was a good idea. There were many workarounds to enable comments in github pages, but I wasn't convinced. Luckily, yesterday I found out about utterances.

A lightweight comments widget built on GitHub issues. Use GitHub issues for blog comments, wiki pages and more!

It uses github issues to store the comments of each post you create in github pages. So, you do not need to include another third party, you can just keep relying on github pages and Hugo to maintain the blog.

Enable utterances

The process is very simple, you just need to install the utterances app in the repo containing the blog. In the case of this blog, mine is earvingad/earvingad.github.io

The utterances web page is very self explanatory with the instructions. However, depending on the theme you are using, it becomes easier due to some are pre-configured.

MemE theme and utterances

I am using MemE theme, which already comes with a pre-configured config template. You just need to open the config.toml, enable comments and fill the required info as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    # Note: render only in production environment
    enableComments = true
    # directly load the comments after pages loaded
    autoLoadComments = true

 --*- Snip -*--

    ## Utterances
    enableUtterances = true
    utterancesRepo = "earvingad/earvingad.github.io"
    utterancesIssueTerm = "pathname"
    utterancesTheme = "github-light"
    utterancesThemeDark = "photon-dark"
    utterancesLabel = ""
    # Note: https://utteranc.es/

And that's it! Now every post you make will have comments section enabled.

Final thoughts

  • In order to comment, users need to use their github account and must authorize the utterances app to post on their behalf using the GitHub OAuth flow. Alternatively, users can comment on the GitHub issue directly.
  • Utterances is free, open source and all data is stored in GitHub issues. So there isn't need to include anothre third party.
  • Comments will only appear in production (when you publish the post). Using hugo sever -D will not display comments.
  • Still you can reach me on twitter.
If you found this content useful, please support me:
BTC: 1E2YjL6ysiPxRF4AEdXChpzpesRuyzgE1y

Do not forget to share.