Benad's Web Site

History

I've moved from one blogging platform to another four times in the past 14 years. This isn't unusual, as many hop from one service to another depending on what's trendy or where their social circles reside. In my case, I've never used blogs for social networking, instead looking for some kind of stable environment where blogging would be convenient and simple.

I started on Slashdot journals around November 2002, during my last year of university (my 6th year of post high school studies). That environment was clearly an afterthought of the Slashdot service and didn't feel much like a proper blogging service. A modern-day equivalent would be to start your own "subreddit" on Reddit, and make a new post for each blog post. Slashdot is first and foremost a news link service with powerful commenting abilities, so it has quite an added complexity compared to what should have been a simple blogging service.

I restarted from scratch my "proper" blog on September 2005 on LiveJournal. For a little while I even paid for the premium service, though it was useless for me beyond some advanced site template features. The site looked horrible (but whose LiveJournal blog looked good?), and posting to it on anything but a desktop web browser wasn't convenient.

In July 2010 I moved to Posterous, a blogging service that was first designed to make it easy to post anything by email. It is also the first service I used that supported Markdown. It was incredibly convenient, simple to use, and the blog looked great. One major downside: This was a tech startup, that unlike Slashdot and LiveJournal was short-lived. The service shut down two years later.

That time, I got frustrated at moving the URL location of my blog from one place to another, and thought of a more long-term solution. First, I was already in the process of building my web site on my own personal domain benad.me, so I decided to move to a proper, commercial blog hosting service that would support personal domains, in my case blog.benad.me. The service Squarespace looked trouble-free, with dedicated apps for posting and great-looking templates. A bit expensive, though. Also, its software upgrades were far from trouble-free. Over time, it was difficult to justify the cost and trouble for what amounted to a simple blog, as Squarespace oriented themselves (and their site templates) towards small e-commerce and design portfolios.

Issues

Over the years, I've had several concerns about using 3rd-party blogging services instead of self-hosting my own solution:

  • The hosting service could go away. Now, I admit that LiveJournal, and even Slashdot, are shockingly still up and running after all those years, something unusual for free web services after 15 years. Still, I got badly burned with Posterous, and anything that doesn't have a clean process to export your entire blog from day one, and not as a favour days before the service permanently closes, is risky.
  • The hosting service can be insecure. Luckily, it wasn't the case for me, but anything resembling Wordpress, or countless PHP-based CMS like Joomla require constant security patches, and are the target of hackers.
  • Content ownership can be a grey area. Sure, you own the original copyright of your posts, but for the service to work you have to grant them some redistribution rights, at minimum to let them host your content. Over the years, licensing gives those companies greater latitude in selling that content, especially on free hosting services.
  • Finally, the posts' URLs are unstable. A link to one of my blog post on service X might not work a few years later. I want to use a solution that will give reliable URLs in the future, regardless of my decision of where of how I would host it.

A Static Blog

The long-term solution would be to host my blog myself alongside my main web site, yet how can I do that if I want to avoid hosting dynamic content and worry about security?

Actually, why do hosting a web blog assume that the content has to be dynamically generated by the web server on demand? Surely there are offsite static blog generators that can build up a collection of generated web pages from some blog "source", and from there I can simply copy over the static pages on my web server.

My main site is already using some static template system, but doesn't have any of the logic necessary for presenting many pages in a blog-like structure. I could either code that myself, or use another blog generator tool.

Sure, I lose the ability of posting directly using my phone, since I have to regenerate my blog static pages from a computer and then upload that, but over the years I rarely posted a final, unreviewed post from my phone anyway. Also, I would lose blog commenting, unless I use some 3rd-party JavaScript option that injects a comment section dynamically over my otherwise static blog pages.

I ended up using Hugo, a static web site generator written in Go that has powerful template-building features and supports anything that's needed for a blog. It has enough flexibility to generate my blog pages with the exact same HTML structure as the rest of my web site, making its integration seamless. As for commenting, I used Disqus.

The Last Import

Moving from Squarespace to Hugo took a few days of effort. Squarespace's only export format was something that was compatible with Wordpress which is a large XML document, while Hugo expects blog posts to be in one individual HTML or Markdown document per post. For some reason, Squarespace's export doesn't contain the original Markdown I used for each post, even though it's still accessible on their web site, so technically their export tool isn't complete.

So I wrote my own Python script to parse the XML and dump out individual HTML posts for Hugo. There were a few adjustments to be made to the XML. The post creation times were in UTC, so I had to adjust them to my time zone (including daylight savings time transitions) using the pytz Python module. The URLs had to be adjusted with Hugo's structure, but I couldn't replicate it 100% (especially during the times Squarespace mangled my post URLs), so for a few posts I had to resort to server-side HTTP redirection rules. Ultimately, I was able to test out every single URL to make sure they worked in the new environment.

Similarly, the URLs in Squarespace's XML export had to be adjusted for Disqus' import tool so that they match the new Hugo URLs properly.

In the end, it all works well. The Hugo templates and CSS could be adjusted to fit better the rest of the site, but otherwise it's fully functional, including the RSS feed. I placed all my scripts and tools in Bitbucket, and since Hugo can be installed by downloading a single binary file, it's easy to replicate the environment on any other machine.

In the future I may even use Hugo to replace my own aging XSLT template system for the rest of my web site, but then I wouldn't be able to brag about creating my own custom template system anymore.