TheEvilShadoo's Blog

Catastrophe Averted

tags:
@TheEvilShadoo 2026-06-25
Comments

I Accidentally Deleted This Whole Blog

I’m incredibly lucky to have made a backup. Last night, I decided to put in some work updating the various theme components I use for this blog page and improving the image layouts. In doing so, I had the not so bright idea of running $ hugo --cleanDestinationDir with the intent of removing old generated HTML files so that I could ensure there would be no problems in generating new ones. One thing I neglected to consider, however, is that hugo’s default publishDir is “./public” whereas mine is just “.” (/blog). Using “./public” only really makes sense for something like a GitHub Pages deployment, but I don’t use a service like that for this website.

Photo from Catastrophe Averted

How It Happened

So, it turns out that when I ran $ hugo --cleanDestinationDir, it was effectively equivalent to running $ rm -rf /webroot/blog/*. From my prior understanding, I had incorrectly assumed this to only remove published generated HTML files, but no, it just clobbers your whole publish directory (why is a command even included for this?). Poorly documented at best, user-hostile at worst. Should I have been more cautious, yes, but I would also imagine that I am probably not the first user who has had the misfortune of discovering this. I think more clarification is needed in the documentation for this command. For me, it was not intuitive that publishDir and destinationDir are synonymous.

The Recovery Process

Fortunately, I was wise enough to create a backup before attempting such major theme upgrades. Still, I had lost a few hours worth of work. Thankfully, PhotoRec came to the rescue. While searching through the massive undeleted file dump took longer than I would have liked, the seven modified files I was missing were all in there without filenames, but more importantly, with access times preserved.

So, Here We Are Now

This was an adventure in its own right. Certainly not a fun one, yet still, it had its merits. I learned to be more cautious, and the website’s a little better off because of it. “Every experience, however bitter, has its lesson, and to focus one’s attention on the lesson helps one overcome the bitterness.” - Dr. Edward Howard Griggs. This is one of my favorite quotes from an early 20th century author and lecturer which I view as a contributing influence on my overall worldview.

Blog Changelog

Better content scaling, improved the display of title and ending images, stylized tables, inline code, code blocks, and a number of theme bugs were fixed upstream.