Articles now with comments

I don’t write that many articles on that site, but when I do I always feel like I am writing for a void: there are no comments, no likes, no reactions at all. Nobody that says thanks for the info, nobody who reports a spelling mistake. Obviously that’s my own fault for not having a comment section, and for not being on Twitter. Since I’ll never go back to Twitter I figured I’d add a comment section to my articles - but how?

This website is a statically generated site (using Saga, my own static site generator written in Swift) and as such adding a comment section isn’t very straightforward. There are third party solutions like Disqus, but those usually track and spy on users, have bad privacy practices, and I don’t own the data. On the other side of the spectrum are webmentions but that seemed rather complicated to set up. In the end I decided to look into two solutions: comments via Mastodon, and comments via GitHub.

Mastodon

I am a big fan of Mastodon (you can find me on hachyderm) and it seemed pretty cool to embed replies to a toot as comments on an article. I found a really nice open source project: just a simple JavaScript file that you embed into the website, it pulls down the replies to a toot with a specific ID, and then inserts them into the DOM. Extremely easy to customize and style however you want! Sadly, that’s kind the of the only positive things about this solution, with plenty of downsides:

So while I loved the simplicity of the script and the ease of which you can style it, I moved on to GitHub.

GitHub

There are broadly speaking two easy ways to host your comments on GitHub: as replies to Issues, or replies to Discussions. I didn’t really like the idea of abusing Issues as comment threads for articles, so I focused my search on using Discussions for this. I only found one open source project that did what I wanted: giscus. The idea is simple: users log in with their GitHub account, and then they can react to and comment on the article. A Discussion for the article is created if it doesn’t already exist, and threaded replies to the Discussion are shown as comments below the article. But people can also directly reply in GitHub themselves which is pretty nice.

Compared to the Mastodon solution this has some really big upsides:

There are a few downsides though:

I think the upsides by far outweigh the downsides and so I added giscus to this site, and you can now comment on all articles! I have no idea if anyone will actually use the comment section and if it turns out that nobody does then I’ll probably remove it again, we’ll see :)

Written by

Kevin Renskers

Freelance software developer with over 25 years of experience. Writes articles about Swift, Python, and TypeScript. Builds Critical Notes, and maintains a bunch of open source projects.

No AI was used in writing any of the content on this website.

Recent articles

› See all articles