A Return to Blogging

Over the last couple of days I've finally scratched an itch I've had for a few years now: fleshing out the software I use for blogging.

Over the years I've had various blog incarnations. The first blog I started, daredevilplanner.blogpot.com was on the blogger platform back in 2004. Over the years I migrated to a few different self-hosted Wordpress installs. While I was working on Grazr, I started using a Wordpress install on my own host for blogging at blog.grazr.com. After Grazr wound down I switched over to this domain, mikepk.com and continued using self-hosted Wordpress. I also had a few side projects that had their own blogs and eventually consolidated all of that content here as well.

With every change, I migrated the content. Using self-hosted Wordpress initially made that easy. The way Wordpress saves content is odd, so migration efforts to something other than Wordpress always seemed like they would have taken more time than I was willing to commit.

Wordpress worked great for a while, but then the fatal flaw appeared. Not having the time and energy to continually patch and update the Wordpress install, the host with my blog started to become a continuous target for bad actors. Wordpress is (was?) notoriously buggy and insecure. The blog site and host system were compromised too many times to count.

I worked around it for a while, building mitigations to make Wordpress more secure. I set up the host to be "throwaway" and made it so I could re-create the blog automatically with a couple of scripts. I locked down Wordpress so that it basically had no permissions to write to the database or the filesystem. It was all too much work and a royal pain. It made creating new content almost impossible. This was probably around 2015.

I finally decided the best path was probably not to have a dynamically generated blog anymore. I spent a few hours and used my own web framework code and my knowledge of the Wordpress database structure to read out all the posts I had accumulated and write them out as static files using the templating system used in my web framework (mako). It was kind of a "one-way" path where I was able to publish all of my old blog content but there wasn't really a good way to create new content.

Then my goal was to have a no-hassle hosting solution. I used this simple process to extract all of the content and then hosted it using a combination of an s3 bucket and cloudflare. That turned out to be exactly what I needed. It eliminated the need to think about servers, hosts, or patching dynamic site code. I don't have a high-traffic site so the overall charges were only like $1-2 a month for s3 storage.

Around this time static site generators were also just starting to get popular, the first I saw was Jekyll (I wasn't planning on doing Ruby) then Hyde, and lately Hugo (I've been toying around with golang lately). Since I wasn't writing new content and focused on lots of other projects I decided to leave my pile of static pages alone.

And so it sat for almost four years.

There was a lot going on in my life during this time: transition from startup founder to being part of a bigger company, moving across country, becoming a father, but I'm saving those for other posts.

Recently my situation has changed again and I decided it was time to maybe dust off this blog and start writing again. Naturally being an engineer the first thought was what system will I use to publish new content? :) I was tempted by Hugo but decided ultimately that with a little love my own framework could likely serve as a reasonable foundation. I decided to take the one-way static generation process I'd slapped together and flesh it out so I could publish new content as well as existing content. I've got some free time at the moment so this seemed like a fun little diversion.

My wife joked with me, "why on earth are you writing blog software? Just use Wordpress.com" It's a fair point, it's like boldly going where literally thousands have gone before.

There are a few reasons why I would do this. I want to "own" my own little corner of the internet if possible. Having my own web framework, I have most of the raw materials sitting around. I like things to work exactly how I like them to work. I knew it wouldn't take me too long to do (writing this post has actually taken longer :) ). It gave me a chance to review all of the things I've written over the years. I've got some free time. It's kind of fun!

Why is this video so familiar?

So with that I decided there were just a few goals for polishing this blogging system. The first was to convert all of my content to markdown. This is probably the step that took the longest. I wrote some utilities to do a first pass conversion and then had to mostly eyeball the content to make sure it was OK. I then modified the static site generation code to use files and markdown sources instead of MySQL and content in "Wordpress format".

Using markdown solved two problems at once. The first was to make the content more portable. If I ever wanted to host it in a different way or use a different system, markdown makes it easy. The second problem it solved was my "new content" problem by allowing me to author new posts in Markdown directly. (I've found Typora to be a really nice editor for writing wysiwyg markdown.)

I decided to use raw files to store the source content. With raw files, I needed somewhere for post metadata so I copied the "front matter" model that's used by most of the static site generators (i.e. Jekyll, Hyde, Hugo) -- including a small chunk of YAML at the top of the markdown to describe post metadata. I figured by following their model, if I ever wanted to use Hugo, it would make transitioning easy. I extracted all of the post metadata and created front matter for all the posts. I also decided to use "Github flavored" markdown since that's the markdown I most commonly write. I'm using git for tracking versions and edits to the content.

While not quite web "brutalist" I've been in a mode where I want web content to be as clean as possible, with no extraneous nav, sidebars, ads, decoration or other "flair". I updated my templates to make them a bit cleaner.

I then decided that I wanted to restore all of the old comments that had been on the various blogs over the years. I had used disqus for a long time so the comments still existed. I used the generic embed flavor and spent some time creating URL re-writes for all of the old blogs to point to the new domain.

Out of principle I wanted the site to always be secure. I updated my Cloudflare configurations to make the site always use ssl. Cloudflare makes this kind of thing trivially easy, even for their free services.

Lastly I updated my about me page and recent projects pages since the content there was super out of date. Even though it pained me, I even uploaded a new profile picture. The photo I had attached to most stuff online was probably like 15 years old so I was way past due for an update.

Lastly I decided to write up a little bit about what I did to create this site. I may write a follow up describing the various tools and code I used to convert from Wordpress to markdown + yaml and how the site renders.

Hopefully this won't be the last post on the site for another six years :)