Static Comments for Jekyll with GitHub Pages

Disqus is the most popular comment solution for Jekyll at the moment, but it has one huge problem. It sucks. It’s free proprietary software filled with tracking scripts that slow down your website.

Since Jekyll sites are static there was no way to store comments without such external service or database. Well, at least until Staticman.

Staticman is an open source static comment solution for your Jekyll site. It allows you to have user-generated content on a static website.

I just have finished setting it up on this blog. I have used this amazing guide by Travis Downs. I’m really happy how it works. Here’s a quick summary:

  1. Staticman can be hosted on any platform with NodeJS. I am using free Heroku app, but there are many other options. More details here.
  2. Jekyll theme will need a simple HTML form that will post comments to Staticman API. I have borrowed most of HTML/CSS/JS from the guide I mentioned earlier.
  3. Staticman will create a pull request with the comment data. It can also commit directly without approval. Note: GitHub access token is required.
  4. You’ll approve the comment and merge the pull request.
  5. GitHub Pages (or your custom solution) will build your Jekyll site with the new commit.
  6. Comment will appear on your website.

That’s it. When you get it up and running, it works. Try it below.


Comments







Ernestas, 2021-04-30 21:29

Yep, even replies are working with some HTML/JS magic.

Ernestas, 2022-05-02 20:57

Each comment has a permalink with unique ID. When you reply to the comment, the ID is saved to the replying_to_uid field, which is then rendered as a reply. You can see an example here.

However, it doesn’t support nested replies, that’s why I can’t reply directly to you now, but I can always use the same thread.