Last Friday I published a post on my blog entirely on accident. It was a short outline of just a few bullet points, sent to be turned into a full post over the next couple weeks. I thought it may be interesting to write a tiny incident report about how it happened and what I’m changing to avoid it happening again.
My blog workflow mostly involves shuffling static files around between Obsididan and two git repos. I compose and edit posts in my Obsidian vault, sync them into my private “blog” git repo with a script, and process them with a static site generator[1]. When I push that repo to GitHub, the SSG creates the HTML and makes an automated push to my GitHub Pages repo. Posts can be marked as draft; drafts don’t appear on the front page or the RSS Feed.
Satisfied with my post about language servers, I decided to publish it. I made final edits, removed the draft marker, synced the state of my repo, and published. I didn’t even check my site’s new build, because I felt confident in the output. Later that night Blaggregator informed me of two new posts to my blog. One was my LSP post; the other was an outline I hadn’t even started writing.
It turns out that I had totally forgotten to add the “draft” checkbox to my draft’s frontmatter in Obsidian. By design pages with no draft boolean are considered in a non-draft state, so that I didn’t have to modify my back catalogue of posts when I added the draft feature. When I made that decision I didn’t consider the high potential for unsafety it introduced. If I start jotting thoughts into a new draft, say on the train, it’s pretty easy to forget to configure the front matter. Then later it will get scooped up and published alongside something else.
In order to avoid this issue again, I can see two workable changes. One is to fail loudly and refuse to accept pages that aren’t definitively marked as “draft” or “not draft.” This will force me to go through and mark drafts as such before publication. It’s hard to imagine me adding the “draft” checkbox to a page’s frontmatter and then failing to check it. If I was worried about forgetting that last step I could go further and fail safe by requiring pages to be affirmatively marked as “published.” No matter how careless or forgetful I am, I won’t be able to publish any draft I hadn’t proactively marked as ready. That’s what I ended up doing: I had to mark my old posts as “published”, and now my blog workflow is a little safer.
At the time I was using Astro on this blog, after having tried Hugo and Zola (the latter of which I used for many years). Over the weekend I switched to 11ty because I was frustrated with Astro’s RSS generation feature. ↩︎