Why I Moved My Site from WordPress to Hugo and Cloudflare Pages
For a long time, my personal website ran on WordPress. It’s a powerful platform with a vast ecosystem, but over time, I found myself wanting something simpler, faster, and more aligned with how I prefer to work as a software engineer. That led me to migrate the site to a new stack: Hugo as the static site generator and Cloudflare Pages for hosting.
Why Migrate from WordPress?
WordPress helped me achievev an attractive look and feel and dynamic content like presenting Youtube videos from my channel or managing my publications, but I encountered a few drawbacks for my personal site:
- Performance: Dynamic sites inherently have more overhead. Generating pages on the fly involves database queries and server-side processing, which can impact loading speed.
- Maintenance: Keeping WordPress, themes, and plugins updated requires ongoing effort to ensure security and compatibility. My site often broke when a plugin needed an update.
- Cost: Nothing beats free when it comes to cost. For a personal site the free tier of providers like CloudFlare are enough. Hosting WordPress websites is cheap, but not free.
- Control & Workflow: As a developer, I prefer working directly with code and text files in a Git repository. It often made me uncomfortable to not have tight control over the code in Wordpress.
Why I chose Hugo
I wanted a static site generator. I considered a few static site geneator options like Astro and Eleventy, and probably they would have worked fine too. I started with Hugo because of its reliance on YAML and Markdown, which I find convenient. I found these general advantages of Hugo, and probably other SSGs compelling:
- Speed: Hugo is pretty fast. It takes less than a second to regenerate the entire site, making local development and previews instantaneous.
- Simplicity: Content is written in markdown files, and site structure is defined by simple templates. No database needed! Once I have the layout adding / updating content is so easy.
- Flexibility: It had no problems handling my video gallery, publications filtered by tags and even this blog. Again, mo need for a daatabase for something of this scale.
- Developer-Friendly: Managing content in Markdown and templates within a Git repository fits my workflow perfectly. I can test changes on my local machine very easily. VS Code for the win.
Hosting on Cloudflare Pages
Generating static HTML files is only half the battle; you need a place to host them. Cloudflare Pages emerged as the perfect solution:
- Generous Free Tier: For personal sites and many other projects, the free tier offers more than enough bandwidth and builds.
- Global CDN: Ensures fast load times for visitors anywhere.
- Git Integration: Deployments are automatic. Pushing changes to my GitHub repository triggers a new build and deployment on Cloudflare Pages seamlessly. It feels like magic.
- Simplicity: No servers to manage, just connect the repository and go.
The Result
The migration involved recreating the site’s look and feel using Hugo’s templating system and Tailwind CSS, and converting content to Markdown or data files (like YAML for publications and videos). I used Gemini to get started. I didn’t even need to use a theme. Just took a couple of hours at night for a few days and I caught up. It took a bit of time to optimize Tailwind, but now the site is overall faster, cheaper and easier to work with.