Automated posting upon new blog post and a neat comment system
TL;DL
Hi,
I have an easy‑to‑use way to automatically toot for a new post and also a easy‑to‑use comment system along with it. My time investment only pays out if other people start to use it, so please check it out: https://github.com/jon011235/mastodon-comments-autopost
This is a very strong case for the saying:
What you can do manually in 5 minutes, you can automate in 6 hours
or something like this
Just to use an over‑used comic ever more often:

I hope this will not end up like this and will run silently most of the time. To do the license justice, this comic is from XKCD by Randall Munroe. The title is Automation and it is licensed under the (out‑dated) Creative Commons BY‑NC 2.5 license, which means sharing and adaptation is non‑commercially allowed, but requires attribution. That is a bit of a tangent, but normally the attribution along an XKCD comic in the wild is not what it ought to be according to the license. I once wrote a professor of mine about it, but for some reason he never answered my complaint. (Also I guess Randall Munroe does not really care as long as there is some kind of link or name, and even otherwise probably not).
What it does
Interaction is something nice; I do not simply want to cry out into the void, and in order to do this I guess I need comments. Hosting a comment system is bothersome, and there are countless services that already enable replies and short texts. In particular, Mastodon, which is decentralised, open‑source, viewable without login and has a decent API, looked very promising for comments. In fact, multiple people already implemented comments on their static blogs using Mastodon:
- https://jan.wildeboer.net/2023/02/Jekyll-Mastodon-Comments/
- https://github.com/dpecos/mastodon-comments/
- https://www.fabriziomusacchio.com/blog/2023-07-31-mastodon_blog_comment_system/
But they all require you to build the blog, create a post with the link to the block, get the ID of the post, change the post and then push and build it again. I am certain that I would forget this at times and it is also just very annoying, so I decided to automate it.
Issues on the way
I started with a simple AI‑generated script and then tackled all the issues and rounded it off. I think the head start was still worth it; the code was solid, but simply not perfect and not adapted exactly to how Jekyll works. However, since there were parts I did not have to touch, I think it is fine.
I’ll spare you the details, but I want to document what was particularly weird and hard to debug:
- Until a few years ago GitHub Action tokens had write permissions by default; now you need to enable this explicitly under
Settings -> Actions -> General-> Workflow permissions. -
The workflow has three jobs: the first tooting to Mastodon and the committing and pushing of the comment IDs, despite using the
needstag to ensure sequential execution and usingwith: fetch-depth: 0in the checkout step, which apparently solves this issue for some. I still needed to explicitly add a step to pull from the repo
- name: pull # Needed because otherwise it will not see the commit done by the toot job run: | git pullotherwise it would not have the commit with the new
comment_ids. -
I also had my fair fight with the layout system. Somehow the whole layout broke when I just copied and modified the
post.htmlof minima. Which, I guess, makes sense, as the other files were not present locally, but it would be more intuitive and easy to use otherwise. This also persisted when using a new file and integrating the text using{{ content }}, which apparently should already render the text before integrating it. - Furthermore I did not know that jekyll computes the dates in the URL in accordance to UTC and not the provided timezone, which caused my generated links to be wrong as then the post would be on another day. I have not fixed this, so as always be careful with timezones!
The rest is a bit more rant‑like and not limited to this project:
- Why is the footnote system so weird? I needed a lot of time to find out the exact syntax that works and which parts of it can be changed.
- I also had a problem where my headings would not be rendered, but everything else1 worked. I still have no idea why; there were no spaces behind the text and no newlines around it. Furthermore, this is one of those issues where it is quite hard to find something about it online, because it can happen through more trivial stuff (like the render not working at all).
And now?
I guess now there is just one thing left: follow my Mastodon announcement account and comment below.
The GitHub repo of this project: https://github.com/jon011235/mastodon-comments-autopost
-
Including footnotes!!! ↩