I just saw someone wearing noise-canceling headphones get into their car and immediately start to drive away without looking. He narrowly missed slamming into a car that was already in motion and was honking its horn, probably because he didn’t see or hear it.

A Workflow for Microblogging

The recent changes I made to my blog to add microblogging support included setting up a Micropub to GitHub web service. This allows me to use the Micro.blog app (or any other Micropub-compatible app) to compose and publish new microposts. However, the web service doesn’t currently support a Micropub media endpoint, so I can’t attach photos to new microposts using the Micro.blog app.

Once again, Workflow to the rescue! I’ve created this workflow for publishing microposts on my Jekyll-powered blog that can also include photos. Instead of relying on the Micropub to GitHub service, it uses GitHub’s API to directly upload and commit the micropost–and attached photos–to my blog’s repository. This automatically triggers a site deploy on Netlify, making the new micropost and photos available a few moments later.

When run, the workflow does the following:

  1. Prompts me to write a new micropost.
  2. If the workflow was not run as an action extension, it asks if I want to add any photos (the workflow checks if any photos were shared when run). I can then select photos from my library.
  3. Resizes all photos to 1000px wide. Photos that are already smaller than 1000px are not resized. I don’t want to share full-size photos, so reducing the size suits my needs.
  4. Asks me to confirm or change the file name for each photo.
  5. Uploads the photos to my GitHub repository and commits the changes, triggering a deploy with Netlify.
  6. Creates the micropost text file with the composed text and current date. If photos have been included, Markdown-formatted photo links are added at the end of the text file. This text file is uploaded and to GitHub and committed. Netlify then does another deploy, making the post available.

Although I created this workflow primarily as a way to publish photos, I can also use it to quickly publish text-only microposts. What’s more, I can even dictate new microposts and publish them straight from my Apple Watch.

If you wish to customize the workflow, change the following parameters in the Dictionary action at the top of the workflow:

  • token: A GitHub token that has read/write access to your repositories.
  • username: Your GitHub username.
  • repo: Your site’s Repository.
  • directory: The directory to save images to.
  • site_url: The URL to the website.
  • post_dir: The directory where micropost text files should be saved to.

The configuration options have been created based upon my implementation of microposts. Depending on how (and where) you publish microposts, you might need to make some additional changes to the workflow.

Microblogging

I’ve made some changes to my blog so that I can also use it for microblogging. Microposts—short posts without a title—are displayed on my home page and published to Micro.blog (I’m @jordanmerrick).

There are separate pages for viewing just blog posts or the microblog, and some additional RSS and JSON feeds:

I didn’t want existing followers to start seeing microposts in their feed readers without opting in, so the current RSS and JSON feeds continue to be used for blog posts only. If you’re an existing follower and also want to receive microposts, you can either use the new feed for all posts or subscribe to the additional feed for microposts.

Thanks to this helpful guide by Fiona Voss about microblogging with Jekyll (the static site generator this site uses), I’ve also set up a Micropub to GitHub service. This creates a Micropub endpoint that converts requests into a Jekyll-compatible format and commits them directly to my blog’s GitHub repository. With this endpoint, I can use the official Micro.blog app (or any app that supports Micropub) to write and publish posts.

Once a new micropost is added and committed to the repository, a deploy is automatically triggered over at Netlify that publishes the latest changes.