Hacker News new | past | comments | ask | show | jobs | submit login
Adding Mastodon Comments to Your Blog (beej.us)
93 points by ingve 5 hours ago | hide | past | favorite | 23 comments





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/


If you want to use Matrix instead of Mastodon for your blog's comments, there's https://cactus.chat/

There's a rather long list of other solutions over at https://darekkay.com/blog/static-site-comments/


Aren't they 2 very different things? Matrix is live chat, similar to IRC, whereas Mastadon is a microblogging platform similar to X.

Yes, quite different concepts, but both are federated services that offer the necessary functionalities to be used as comments. One is a bit more "real-time" than the other.

I should perhaps also add a little disclaimer/warning: When i had a closer look at cactus comments a while ago, it seemed to be broken / "assembly required" in various parts and blogs that use it.


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


Nice write-up! That the “View comments” simply redirects to the source post when JavaScript isn’t available — it feels very natural, more than I’d have expected!

I wanted to do something similar a while back, but while avoiding JavaScript; so I wrote a shell script that outputs fedi/Mastodon threads as HTML. It’s almost certainly less stable than your approach, but it works well enough for my use-case: https://hak.xwx.moe/jadedctrl/fedi2html In action: https://jaded.xwx.moe/lib/haiku-k-esperanto.html?en


Nice! I'm waiting for (/ thinking of building) something similar for #atproto/Bluesky. You could even use OAuth to allow users to add responses inline, which would then also show up in the Bluesky feed (if you wanted), with a UX pretty similar to Disqus.

Mastodon is great, but the "pick a server" step is a pretty hard filter for most users, who just want to sign up for something.

You'd also get to benefit automatically from Bluesky's blocking/moderation tools.


But bluesky is a proprietary service based in the US. A less privacy friendly choice for your readers/commenters.

If you're using Quarto, I've got a plugin that adds bsky and masto comments

https://andreasthinks.me/posts/quarto_comments/open-social.h...


I did something similar recently - and was inspired by others who did it:

https://blog.nawaz.org/posts/2025/Jan/adding-fediverse-comme...


Great read. I posted some thoughts on the pros and cons of using Mastodon for comments. Overall, it's been a positive experience for my blog.

https://jszym.com/blog/mastodon_blog_comments/


I wonder how that scales. I'm sure it wouldn't matter too much for a small personal blog but I assume the mastodon server wouldn't be very happy if the API was queried at a high rate.

The author made some sane choices by having the user press a button before loading the comments

Yeah, I made a note of that. I'm not sure anything I've written to my cheesy blog has hit HN before, so this is probably the biggest test I'm going to get.

If it were going to get any bigger, I'd want my own Mastodon server.

Edit: this is also why I made it an explicit user action to load the comments.


I really like GitHub comments on blogs.

As in "utterances" and "giscus"?

Github is a proprietary service owned by Microsoft. Storing comments there is a less privacy friendly solution than this one.


mastodon is a fediverse client

[flagged]


What weird fake information you're posting. Yes, administrators of fediverse servers can read your personal correspondence -- same as Facebook, X, and other social media sites that don't offer federation (unless you opt into some limited e2ee option). But I, as a fediverse admin, have no ability to read (private) correspondence between two others who don't use my instance.

Ultimately it comes down to: you must trust your instance admin. (Just like you must trust Facebook and X and Tiktok and whomever else). As a result, maybe take private conversations somewhere safer, like Signal or a pgp conversation. If you don't trust your instance admin, why did you sign up with your instance?


>If you don't trust your instance admin, why did you sign up with your instance?

Probably because you told them it was a cool OSS twitter alternative and not something that takes all of social media's moderation and privacy and content problems and multiplies them by the number of instances you join without any of the legal protections associated with being able to file civil or criminal complaints against an identifiable entity answerable to the laws of your country.


I can't think of something more hostile than requiring an account on a 3rd party, totally unrelated, platform to post a comment on a blog.

I'll literally take ads and tracking over it.


Mastodon is part of the fediverse, meaning accounts are federated (accounts on services can communicate with other accounts on other services).

You can run your own server, on your own hardware, make your own account, own every step of the stack, and can comment on there.

It's not just 3rd-party login, it's YOUR-party login.


I could add a button to swap the comments out for ads and tracking. ;)

To your point, though, I don't expect anyone without an account already to post, but my target audience largely already has such accounts.


Disqus requires an account on their system, too.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: