locxter.net

Adding comments with giscus

2022-11-20

I am a huge fan of the KISS principle, which is also the reason why I write this blog in plain HTMl without even using one of the excellent static site generators like Hugo . However, I feel like having comments on a blog is a non-debatable requirement. Therefore, I searched a bit for a fitting solution, found giscus and now want to enable you to use it as well.

Inspired by the very popular utterances , which uses GitHub Issues to host comments on static sites like this one, giscus is based an the newer GitHub Discussion system. To be clear: Both are fantastic projects! But I think that giscus uses a better fitting and more appropriate implementation and that is why I personally chose it over utterances.

In order to use it yourself, you have to meet several requirements though:

  1. You have a GitHub account and a public repository to store the comments in.
  2. You installed the giscus app on your GitHub account. Here is the link to it.
  3. You enabled the Discussions feature for the desired repository. Here is how to do that.

If that is all set, you can head over to the giscus site and configure it to your liking. After filling out the bare minimum fields like the language and repository to use, I personally recommend to do several other tweaks:

  1. Change the Discussion mapping to Discussion title contains page title .
  2. Enable Use strict title matching to avoid mismatches.
  3. Create a special Discussion category for comments and select it.
  4. Enable Place the comment box above the comments for easier usage.
  5. Enable Load the comments lazily for better loading times, especially if there are many comments.
  6. Choose the color scheme that fits your site's theme best. I use Transparent Dark .

Finally, copy the generated HTML snippet over to your site template and enjoy comments!

RSS feed