Live data from Hacker News

Adding Mastodon Comments to Your Blog

beej.us

1–10 of 63 posts

Re: Adding Mastodon Comments to Your Blog

#2
This is a nice idea!

I ended up doing something similar, but statically, and searching for discussions dynamically rather than using a single hardcoded thread. Essentially it's a script that searches for recent posts linking to my domain name on Reddit, HN, etc, and then updates a file with the URL of that post and some information about when it was made and how many posts there are. Then there's a Hugo template that converts the data in this file to HTML.

The script runs every few hours using free GitHub runner time, and if it makes a change, it commits it and creates a pull request with the contents so that I can review it. (I could automatically commit straight to the main branch but I like having the manual review just in case.)

I couldn't get it to work for Mastodon because there's not really a public search for Mastodon (for all sorts of reasons), although at some point I want to get it working for Bluesky. I did try hooking it up with Twitter for a while, but that required all sorts of API keys and things that I didn't want to deal with so I gave up. You also need API keys for Reddit, but that was easier to get hold of and manage.

I wrote a post about how I implemented it here: https://jonathan-frere.com/posts/adding-discussions/

Re: Adding Mastodon Comments to Your Blog

#8
After spending far too much time integrating third-party comment systems into my website, I finally decided to roll my own in Common Lisp [1].

I’m quite happy with the result. It’s simple, minimal, and fast. It does exactly what I need and no more.

Plus, everything is held for my review before being published, so I don’t have to worry about spam, cross-site scripting, or off-topic comments. It’s been a satisfying solution.

[1] https://github.com/susam/susam.net/blob/main/form.lisp

Post reply on HN