New Blog. Now static

New Blog. Now static

While I haven’t spent much time writing for this blog this year, I have spent some time changing the whole platform. Going from a dynamic Wordpress site that requires PHP and mySQL database to one that requires nothing but the most basic web server functionality - the ability to send out static files.

Why?

When it was time to pay the yearly fee to my former web host, I started to think there must be a cheaper solution out there. It felt expensive for such a basic low traffic site.

I looked around and found that Microsoft offers free hosting of small static websites on their Azure platform.

A static website would mean I would not be able to use a dynamic web solution as Wordpress any more. But that suited me fine, as I was annoyed by Wordpress needing maintenance to keep secure. I did not like that I needed to update Wordpress and the plugins every now and then, scared that one might break something on the site.

So a static website felt more right, but I feared it would mean I would lose a lot of features I associated with dynamic websites, like comments, paging and pages with tags and category summaries.

Luckily there exist static website generators. Tools that will make it easy to generate full Wordpress like blog sites. The only missing feature would be comments.

Looking at the ones supported by Azure, I decided on Hugo. I mostly decided on that one because it was not based on JavaScript.

Supported by Azure means that I don’t need to build the site on my computer and upload it myself, I can simply commit the source files to GitHub and Azure will build and publish the site for me.

Hugo

Building a website in Hugo isn’t that hard if you already know the web stuff like HTML, CSS and JavaScript. I only needed to acquire some basic knowledge of Go for modifications, Toml for the configuration and Markdown syntaxes for creating all the contents (blog posts and pages).

Luckily the theme I used for the Wordpress side had a Hugo version that I could use to make the new site look a lot like the old one.

Exporting the old site

While creating a new blog wasn’t really any issue, getting all the old contents over was a bigger challenge. I was hoping there already would be tools for migration from Wordpress to Hugo, but I couldn’t find any. I had to make my own.

Nothing fancy was required at least, just something that could parse through a dump of the wordpress site, do a lot of find and replace on all the different syntaxes used and dump out a bunch of new files.

And then the old website went down.

Website down
Website down

I thought I would have a whole year to work on the new site before it was time to renew the contract, but suddenly I found my web host had disabled my site. When I asked about it I got informed that they had changed the IP on the server without telling me.

Instead of fixing that I told them to cancel my contract. I would try to get the new site up as soon as possible.

And here it is!

As good as the old one I think. I will be missing the comments (the real ones, not the spam ones) and maybe someday I might find a solution to get them back again. Until then I will have to ask people to reach me through my socials listed on the top right of the page.

/Henrik