Migrating Blog to Hugo
Current Infrastructure
When I first decided to create this blog I was at a critical point in deciding what to host on-premises and what to host in the Cloud. As much as possible, I was trying to move workloads to the Cloud so that I didn’t have to worry about hardware failures and backups.
My previous experience in Content Management Systems defaulted to self-hosted WordPress installations. I have operated many WordPress sites over the years and although it is not perfect, it is relatively easy to add dynamic content and maintain (once you have set it up).
As most of the services has been moved to the Cloud I didn’t want to create a new service that was on-premisis.
The downside to running WordPress in the Cloud is that it requires a Database to store the post/page content. Two major costs in Cloud computing are Compute (i.e. CPU usage) and Databases (e.g. MySQL). Costs for Hard Disk storage also add up over time but are less expensive than the former.
Although I was using the second smallest Google Cloud Platform Compute Engine (Virtual Machine), this was still costing around $20 a month. Not huge in the scheme of things but I did not want to be spending $240 a year just to host this blog.
It’s worth noting that I did start with the smallest shared CPU instance (e2-small) hosted in Iowa USA (us-central1) as this is included for free in Google Cloud Platform’s free tier. However, when running the WordPress Database on this instance this caused the Compute Engine instance to freeze. See here where I covered this in detail.
As of writing the e2-small
Compute Engine is a “burstable” instance type that
allows you to burst for a time (in fractions of a minute).
This means that you can run 100% for a duration (30 seconds for the free micro
and 60 seconds for the small
instance types) before the instance gets
throttled. In the
shared core E2 machine types
it explains how this is calculated.
The TLDR;
is that it suites workloads that are idle for most of their time and
only need to do small adhoc tasks.
Cost Cutting
With the “cost of living crisis”, 2025 is the year when I would look at everything to see if any cost saving coud be done with my IT costs. Changing up this blog would (hopefully) be a quick win. This would mean that I would have to look at alternative hosting solutions as well as potentially different ways of creating/storing the blog’s content.
Firebase
I had already moved a few static websites to Firebase Hosting. This is super easy to do and is super cheap to run as well. See here for pricing. If you don’t have a lot of traffic then this can be free (or at least near free).
Hostinger
I also looked into Hostinger as they had great deals on managed WordPress hosting for as low as $2.49 USD/month but this required locking in a 48 month contract.
I didn’t love this option as the work to migrate the WordPress instance and all the associated data would only solve the issue for up to 4 years to which, the migration problem would be significantly worse/more complicated.
Squarespace
Squarespace is an awesome product for fantastic looking sites. The templates are easy to use and everything is drag and drop. However for this simplicity there is a cost associated with this.
As of writing this was $18/month which is roughly equivalent to what I’m currently spending with the WordPress install. Although I would not need to worry about backups/uptime etc anymore, migrating all of the blog content to a different format to only save about $2 a month was not something that was appealing.
Hugo
I’d heard a little about Hugo before from other people and thought I would look into it. Hugo is a Static Site Generation framework that takes Markdown files (your content) and then creates rich HTML that can be deployed to a CDN.
One major advatage is that because the whole website is stored in Git I get versioning/backups for free. Though, one day image storage/size may come back to “bite me” as every deployment (configured to keep the latest 3 in Firebase) contains the entire site (including images).
I read through the documentation and decided to use one of templates that was used in the getting started documentation Ananke.
This looked pretty close to what I had previously (as a layout), is simple and I knew that despite styling I would be able to get something up and running pretty quickly.
This left me with the painful task that I was not looking forward to. I needed to download all the images from WordPress and then copy/paste every single blog entry and convert it from HTML/Plain Text into the required Markdown syntax. It was slow and tedious but I did get there in the end.
One unintended side effect that I am still working through is SEO indexing. As
much as possible I tried to keep the same URL syntax between WordPress and the
new Hugo blog. However some things (like /tag/TAG_NAME
in WordPress is
/tags/TAG_NAME
in Hugo), mean that there are now indexing issues in the Google
Search Console. Not a huge deal (for a personal site) but something to keep in
mind if you are migrating a business site.
Developers will probably know Markdown syntax well, but this can be a bit of a learning curve for “non technical” people.
Deployment
One thing I haven’t mentioned yet is that as the whole website content is hosted in Git you need to build pipelines to deploy new versions of the site.
For developers this is relatively trivial but if your used to just adding content to WordPress or Squarespace, you would probably need some assistance in getting these setup/maintaining them.
Result
After the migration was complete I waited a few days and then turned off the Compute Engine instance in Google Cloud Platform.

Blog Hosting Costs
As you can see from the above image the cost per day has dropped significantly from about $0.72/day to $0.05. This results in a cost of around $1.50 per month. However, there are still the Hard Disks for the Compute Engine that have not been deleted that have a monthly cost associated with them. This should result in a figure less than $1.50 per month to run the blog which is a big improvement.
Future Improvements
From a deployment/cutover perspective I’m pretty happy with how things have gone. I’m going to close out the final things that need to be cleaned up and deleted now that this has gone live for a time.
There are a couple of things though that I definetely want to improve:
- Styling. I really want to update some of the font, colours, etc to make it my own.
- Links opening in new tab. Currently all links open in same tab which is not a great user experience.
- Images on screen are only one size. I.e. you cannot click on them and enlarge them.