In a Mastodon conversation with Lucas I mentioned that the workflow to publish to this Jekyll blog is one of the reasons I almost never publish on my blog. It’s either that, or an excuse, and since I’m being honest, the more I think about it, the more I believe it’s more of the latter…
- Open a text editor;
- Add Jekyll’s front matter;
- Actually write the blog post;
- Save the file with the expected file name structure;
bundle exec jekyll servelocally to see if it renders okay;
- Catch a few typos;
- Repeat 5;
- Commit and push;
- Load the published post to double-check.
Is not an insignificant number of steps, and I’m lucky that I did place my blog folder on Dropbox from the beginning, so I at least don’t need to move files around if I’m on my phone or iPad.
Blot.in, mentioned by Lucas, immediately tempted me: save a file or an image into a Dropbox folder and have it immediately, automatically posted on a blog. A 2-steps process! At 4$ per month, not expensive either. But I know myself and I’d soon be fighting with the theme or discover some limitations, and I’d certainly want to migrate the current 118 posts, which would lead to building some automations… things would spiral a bit out of control, just like when people instead of completing tasks test 8 different task managers. I really don’t have the time and mental energy for that.
So I wondered if I could automate some of the steps of the current workflow, not really for long form posts, but to reduce friction for micro-blogging with the existing infrastructure of my website. If it’s a couple sentences on the go, maybe on my phone, I could certainly skip the local preview, but the commit and push step would remain annoying, even with Working Copy.
Enter gitwatch and a couple Drafts actions, and less than an hour later I feel I took away a decent part of the friction (excuse) to short form frequent blogging:
A simple Drafts action inserts Jekyll’s front matter at the beginning of a draft (I’ll probably set a Keyboard Maestro text expansion as well, but I started with Drafts because this action will be available on every device);
When I’m done writing a Post to blog Drafts action prompts for the slugified draft name, prepends the date in the format I use and saves it into the _posts folder on Dropbox, archiving the draft with the proper tags;
gitwatch on my M1 Air monitors my _posts folder and automatically commits and push.
Perfect? No. Faster? Yup! Possible Improvements going forward:
- Move gitwatch on my Mac VM running on Proxmox, instead of my Air, so it really runs all the time;
- If I can find a way to pipe aicommits commit messages to gitwatch, I’d very much prefer those to the current “Scripted auto-commit on change (%DATE%) by gitwatch.sh” format… but I can live with it if achieving that would turn this quick excursion into “a whole project”;
- Find a way to quickly post photos, no text, because the Blot.in way to publish images to a blog just by dragging a file into a folder really looked glorious.
This has been a fun, self-contained Sunday morning project. Now we’ll see if I’ll really blog more…
P.S. ça va sans dire, this blog post has been posted directly from Drafts on my iPad and has been auto-committed and published! 🤓
A few updates, later in the same Sunday:
I’ve added link posts and photo entries to this site. Adding photos is interesting, as it involves Shortcuts saving the resized JPG into a folder watched by Hazel, which then renames and moves it in the Jekyll subfolder and freaking generates the markdown page as well directly in the Shell script. Just like for the Drafts automation this morning, commit and push are then automatic, courtesy of gitwatch.
- I’ve posted both Drafts actions to the Directory:
- I’d still like to improve a few things:
- Actually having a caption for the photo posts based on the file name, which therefore should be specified in the Shortcut instead of being autogenerated by Hazel;
- Maybe have separate RSS feeds, because currently everything (normal posts, link posts, photos) goes into https://cdf1982.com/feed.xml
- Some mechanism for automatic cross-posting to Mastodon. All things that can wait until I actually prove to myself that I’ll blog more.