Migration to hugo
![/2020/hugo-migration/hugo-migration_hu9017616143061498057.webp /2020/hugo-migration/hugo-migration_hu9017616143061498057.webp](/2020/hugo-migration/hugo-migration_hu9017616143061498057.webp)
Intro
It was about time to do this. This website only contains some articles i wrote for small projects or other cool things. There’s nothing really “dynamic”, nothing that requires real user feedback.
I was running this website with B2Evolution, a very fast PHP CMS that has got everything I needed and much more. Take a look at the website: you can have a very complete solutions, with blog, photo gallery, forum… Also it’s free and open source. But I wanted to change to something faster.
Why I didn’t choose Wordpress
Wordpress is not an option. I hate wordpress: it’s bloated, slow, it needs a lot of extra plugins in every installation, and it makes A LOT of db queries for each request. Plus, it’s widely used and this means two things: stable codebase (which is good) and a lot of 0-day vulnerabilities (which is not good). Let’s make it clear: Wordpress codebase is top-notch, it’s very hard to find some vulnerabilities in it; despide that, every now and then, a vulnerability is found and corrected or exploited, depending on who found it. So if you’ve got nothing else to do in your life, you apply upgrades on your wordpress every 6 hours, and this still doesn’t put you on the “safe side”. The worst part is the plugin status: you need a lot of them (for caching, managing automatic upgrades, comment spam, statistics… your theme also can ask for some extra plugins), and their code is not as vetted as the wordpress one.
I also tried GRAV
I almost completely migrated this website in GRAV and I can only say that I like it. GRAV is a “flat-file” CMS, so no DB required, it’s written in PHP and it’s really fast. The admin interface is simple and complete and you can manage it with GIT. It’s a great alternative to Wordpress, and you should totally check it out if you’re WP-tired. You can have a “local installation” synced with “production” via git, and have the admin interface removed from the latter. By the way, this is still PHP-based, so the search goes on.
The jekyll no-go
Jekyll was my first choice: I hade some experience in the past, for stupid-small pages. Jekyll is a “website generator”, exactly what I wanted: I write a text on my computer, the “local website” gets updated, if it’s OK, I upload the modifications. The real struggle was the setup, at least on my Mac: you need to install brew, then a ruby development environment, some gems, with all the dependencies… I tried to simplify the development with a docker image, for sharing the same environment between OSX and linux; that seemed too much so I switched to Hugo.
go Hugo
Hugo has lower requirements: only brew on my Mac, and it’s packaged for any recent ubuntu. I easily recycled the conversion work I did for B2Evolution: only a little work was needed to adjust the contents, because everything already was written in markdown. I installed a theme, some minor customization, and we’re online: the complete website is just a handful of megabytes, without any server-side script. Sweet!
Comparison
The previous website was already fast, I did all this just to remove any type of scripting vulnerabilities. But I did a speed comparison anyway.
I used the raid 666 article for reference and checked the page with webpagetest.
- Time to first byte went down from 0.385 sec to 0.143 sec
- The full page went down from 1,686 KB in 49 requests to 162 KB in 20 requests.
- The page load time was 2.019s and now is 1.699s
The added speed bump is very welcome :)