adding Micropub support


If this post works, this will be the first ever post in this blog to be send using Micropub. Up until now, my workflow was writing the post in Sublime Text 2, running my shell commands to generate the site using Pollen, and finally uploading the generated assets to the server. This served me well for years, but it tied my blogging to my Macbook.

Recently, I’ve fallen in love with the iPad as a writing tool. As my transition into a full-time writer moves on, I’m seeing myself wanting to carry just my iPad instead of my Macbook. So far, I was writing posts on the iPad and then copying and pasting the content into the source tree once I was back home and in front of the Macbook. This is boring as hell.

My first ever software for Mac OS was a blogging client. I’m well versed in Blogging APIs of yore, such as XML-RPC stuff like MetaWeblog API. These days there is a new spec that is endorsed by the W3C and supported by many tools: Micropub]( I’ve spent the last three or so days coding my own Micropub server using Racket—which is the same language used to develop Pollen—and finally reached a point where I suspect this post might actually work and end up live in the browser.

The Micropub spec is very odd. I’m finding some decisions in it a bit strange.

I have no idea why they decided to represent simple strings as arrays with a single string element.

I also don’t understand why if the request comes via form-data it has a key h with a value like entry but if it is a json post it uses type and h-entry instead.

Both cases represent the same data, they should be consistent IMO.

The specs supports requests as JSON posts, form/www-form-urlencoded, and multipart/formdata. But each of those kinds of requests supports different features. Want to update a post? You need to send a JSON. Want to create a new post? Pick any of those three kind of requests. JSON supports all features except file uploading. Multipart supports file uploading, but doesn’t support actions such as update or delete, forms support uploading just a single file. It is a bit odd.

Also there are lots of specified behaviours for when fields are missing. You have action update, delete, and undelete, but if there is no action in the payload then it is to be treated as a create action. This is double odd in my opinion.

So far, I’ve only implemented the happy path of creating new h-entry articles. Let’s see if this works…

Did you enjoyed reading this content? Want to support me?

You can buy me a coffee at ko-fi.

Comments? Questions? Feedback?

You can reach out to me on Twitter, or Mastodon, Secure Scuttlebutt, or through WebMentions.