Hugo Is Awesome - Why I moved from Ghost to Hugo
Hugo is a framework to build static websites. Yesterday I migrated this blog from Ghost - a dynamic NodeJS based CMS - to Hugo, not only to reduce the hardware requirements (a static page uses way less resources), but also to simplify my setup.
I already use Hugo for two basic homepages (my personal one and the AndroidPub one), where I don’t have that many requirements regarding “blogging”, because I don’t use them for blogs. Blogging was the thing that hold me back from migrating my blogs from Ghost to Hugo, because I wasn’t able to find a theme that satisfied my needs.
Webhooks and Auto-Deployment
I have a private Gitea instance, which I use for all my private repositories including the code for my websites. The ideal solution is to just commit some changes to a content page and the Hugo output gets automatically generated and published. I do that by using a Webhooks-Container (I use this Docker image, with the Docker binary and socket mounted) that gets triggered by a call from Gitea and automatically starts some containers that pull the latest source for the websites, generates the static page output in a Docker volume, which is also mounted to the Caddy-Server I use. So each time I edit the content of any of my sites, a container gets started, produces the site and then shuts down again. Minimal resource usage and no need to do anything manually.
Doing this, also allows me to do changes from the Gitea online editor, which replaces the need for the Ghost web editor. I can also edit my website from PCs without Git installed or even my mobile phone.
I’m currently tyring to become a minimalist (more on that topic on my personal blog) and switching blogs from Ghost to Hugo aligns with my goals to declutter. Using a code editor (like Visual Studio Code) let’s you focus much more on the content of your posts instead of useless formatting or settings. It also gives you the possibility to write posts while being offline. With Hugo’s build-in server you can even preview the post on your laptop.
For this development related blog I chose a minimalistic theme without images (which I heavily modified), because who actually cares about random images (although I like those Unsplash images)? This not only increases the page speed a lot, also less styles and JS let the site load and render much faster, so you can even read this post on slow GPRS or EDGE connections. For my other blogs (which I will migrate sooner or later too), I’ll probably enhance this theme, chose or create another one.
Less resources and reduced maintainence
Using a static site generated with Hugo not only reduces the memory and disk usage a lot, it also helps with stability. If some of my posts go viral, my server will survive longer, because it’s just a static file served without calls to databases, server-side rendering etc.
But it also reduces the needed maintenance. Sure, I do need to check my sites and themes for compatibility with newer Hugo versions and I update my Hugo Docker image when new releases come out. But that’s most often just to get new features and not because the site had some (probably insecure) bugs.
The sites are served by a Caddy instance I also use as reverse proxy for all the services on my VPS. But theoretically, I could created hundreds of extra blogs, without the need to upgrade to a bigger server.
I don’t use a service like GitHub pages or Netlify, because using my own server really guarantees me full control. But it would be a good alternative, if you don’t want to manage your own server. Netlify can also cover the automatic deploy process.
Tags: Server Docker Hugo Ghost Gitea