Tidying up around the place

Volume 7, Issue 4; 07 Jan 2023

Removing a bit of bird site detritus, automating toots, fixing bugs.

I forget exactly how or why I thought this was what I should be doing this morning, but I’ve managed to tidy the place up a bit, so I guess that’s a good thing.

I think it started with tweetback. I got an archive of my tweets and loaded it up. I thought tweetback was a Node application, and it is, but I was delighted to discover that the output is a completely static archive. So took only a few minutes to spin up. Nice.

That got me wondering how many links I had in this weblog that point back to I like my links to be stable and persistent, but I have very little confidence in the continued reliability of that site. Turns out there were about a dozen, so I edited things to make them point to my archive. (Well, my tweets, anyway, there’s nothing I can do about links to other people’s tweets, unless they setup an archive as well.)

In the course of doing that, I fixed a bug in the “topic editor” that’s been bugging me for ages. (Nothing you can see, but sometimes you just have to scratch what itches.) And I noticed that updated pages didn’t include a “last modified” date. So I fixed that as well.

Now I had the hood off, I thought I should see about automating toots. I’ve been using a third party service, which is fine, except that the service changes occasionally without warning and in ways I can’t control. And when I include an image in a toot, it loses the alt text. The Mastodon community is pretty assertive about providing accessibility and I like that.

Right then. Looking for a lazy solution in between kneading and shaping some sourdough, I figured I’d work out how to automate a command line tool. I’ve played with toot a bit and it seems to work. I proposed fixes for a couple of bugs in it last week.

Next, I tinkered with the code that inserts new weblog posts so that it would generate a little summary I could use for tooting. Like this, for example:

  "toot": "/2023/01/07-housekeeping",
  "micro": false,
  "title": "Tidying up around the place",
  "text": "Removing a bit of bird site detritus, automating toots, fixing bugs.",
  "images": [],
  "alts": []

Good. That was complicated a bit by the fact that for “micro” posts (the ones you see at the top of the home page that often include photographs), I had to extract the image links so that I could pass them to toot as media files. But, you know, SaxonJS on Node.js is da bomb.The author may be biased, ed. With all that sorted, I had only two dots left to connect.

I thought about extending toot, or writing a program that uses toot as an API, but I decided that was more work than I needed to do. I settled for a little script that watches the directory where the summaries are saved. If it sees a new file, and if the URI identified is publicly accessible (it won’t be until I hit the “publish” button), then it constructs a toot command line to publish a link to that post. If toot succeeds, it deletes the file.

Again, a little complicated because what I have in the summary is a URI for the image page on and what I need is the actual image file. This far down the rabbit hole, you just gotta keep digging.

These last two bits of string are tied together by a cron job that runs every five minutes. A little loose coupling here seems like a good idea.

It occurs to me now that I could (should?) update the posting tool so that it includes post topics as hashtags. Not today, though. I gotta go bake some bread!


Please provide your name and email address. Your email address will not be displayed and I won’t spam you, I promise. Your name and a link to your web address, if you provide one, will be displayed.

Your name:

Your email:


Do you comprehend the words on this page? (Please demonstrate that you aren't a mindless, screen-scraping robot.)

What is nine minus four?   (e.g. six plus two is 8)

Enter your comment in the box below. You may style your comment with the CommonMark flavor of Markdown.

All comments are moderated. I don’t promise to preserve all of your formatting and I reserve the right to remove comments for any reason.