Auto Posting to Mastodon
Something that I find a little annoying is having to manually post things to different social media. I like to post JUST to my site here and then syndicate to socials, mostly just mastodon, but I would like to figure it out for other corporate socials too.
There is a plugin for Pelican called Fedivers but I don't like how it manages the API token, and the fact that I would have to put my password in the configuration file, and that I doubt that it would work with 2FA.
I took a look at it thinking that I would be able to make some changes and then submit a pull request, but the problem is that I still don't really know what I'm doing, and not sure about the workflow to develop the plugin in a way that it could continue to be "installable". The other challenge is that then it will only post when I publish the posts, and I don't know about you, but there are a lot of errors that I only notice AFTER its online.
RSS
So, instead, I opted to use the RSS feed for the site to autopost. It can be parsed on a different schedule and I will also be able to use the same RSS feed to post to different sites with their API too. I found this package called rss2masto that does most of the things. Its also written by a "lay" person like me so I found it much easier to read and figure out what they are doing.
I did make a couple of changes to the typical post layout and now I have posted 2 copies of almost all my posts from this site to my Blog Comments account. If you scroll forever you can likely see the change that I made.
How I'm Using it
Currently I have a small VM that I use for random automation, making my nas site, publishing this site, organizing my photos, etc. Adding a line to the publishing script that only runs once a day to run this was simple.
Things I want to change
There are a few things that I would like to change with this going forward.
- Include the opengraph image, if its available, to the post. This is something that I figured out how to do when I was playing with using mastodon for the commenting system here, but the rss2masto is in python so I will have to figure it out a bit more.
- Add tags to the status. The pelican RSS feed includes the tags as category tags, so this should be straightforward, with some sanitizing.
- Move the list of RSS feeds to the .ini configuration file. Ideally I would like the rss2masto script to stand alone and not have to be modified by the user at all.
Until it is working exactly like I'm hoping, I will leave it posting to the bot account, but ideally I will be able to move it to my main account when these things are figured out.
If you are interested in working with this, leoncowle mentions in the ReadMe that they are open to pull requests. The repository is here https://github.com/leoncowle/rss2masto.
This post is part 8 of the "How I Pelican" series: