Hugo vs Jekyll
I'm going to tell you about my experience with Hugo and Jekyll here. One of my secret recipes for my website to achieve:
- Google PageSpeed 100/100
- Google Search Console; 0 error of indexes
- Google Search Console; 0 error of AMP
How it works
- We install Jekyll or Hugo in our local. They are just like a back-end, front-end, and CMS.
- We create the front-end or theme.
- We create the content by using MD or HTML files.
- It will generate static HTML files.
- Deploy the generated files.
In 2016, I started to create a website for my profile. So, I can write articles about my works or blog. It should be fast, indexed, and perfect.
Jekyll was quite popular at this moment. It is built on Ruby and used the Liquid template engine. So, I chose Jekyll as my back-end and wrote articles on it. I was happy with this.
I created custom themes and followed Google rules for PageSpeed and SEO. That was how I achieved Google PageSpeed and no error on Google Search Console.
I got into trouble when I tried to create AMP versions of every article. I need to duplicate every article to the AMP version manually. I did a little trick to make AMP pages not listed on the homepage and sitemap. I had no idea how to make AMP versions of pages automatically or in the right way in Jekyll. Please put a comment below if you know the right one.
The second problem came when I made related articles. I wrote long nested code in Ruby or Liquid to print them. It was not a clean code and caused slow performance.
The third problem came when I got a lot of articles, especially since 2022. The build time in my local is about 2 seconds for every change I have. It is slow or heavy because of printing related articles. There are many articles and the calculation becomes double because of the duplicated ones for the AMP version.
I decided to move to Hugo because of three problems that I got with Jekyll; AMP pages, related articles, and build time.
Hugo can generate AMP versions of our pages automatically. We only need to put
AMP on the output configuration.
[outputs] page = ['HTML', 'AMP']
All AMP pages are started with path
/amp. You also can specify the layout for only AMP pages like
Printing “Related Article” is simple. It also does not affect the build performance. Hugo prints related content with similar tags and the same date.
The last one is build time. Hugo is extremely fast. The build time I got at this moment for every change I made is below 10 ms.