What is a static site generator
A static website generator is software that generates a static HTML website using raw data and code as “input” templates.
In essence, a static site generator automates the task of generating individual HTML pages and makes them ready to be served to users in advance.
Dynamic and static web sites
Examples of static website generators:
Esempi di siti web dinamici:
How it works
A static site generator like Hugo, is nothing more than a program whose purpose is to generate web pages from Markdown code and a template of your choice.
Markdown code, used in the form of files, serves the program as the source from which to obtain the text of the various pages of the site. The theme, on the other hand, is code from third-party developers that deals with the formatting of web pages.
Combining the two components results in HTML-formatted pages with text and formatting inside.
All you need to use Hugo is a computer (even offline), Hugo in fact can function as a standalone web server, but only for testing purposes.
Upon execution of the
hugo publish command, the software will generate all web pages.
Why I chose Hugo
Previously I was using Wordpress, a very powerful CMS suitable for a thousand different uses, but also too much for me. For my typical use it was too powerful, I would even say overkill, with the hundreds of different options sometimes it was hard to find the right page to change this or that setting.
Moreover, I also chose it for a reason of security and especially performance.
In addition, the inherent operation of static HTML pages allows unparalleled access speed. In fact, on PageSpeed Insights I score above 90 on the home page and above 95 on individual articles (the bottleneck is in the images, I still need to work on that).
Pros and cons
- Simplicity: once configured it allows you to focus on writing articles
- Flexibility, ease of customization with themes
- No software to maintain
- Ability to write posts anywhere without using the CMS
- Free hosting (an article about it coming soon)
- Possibilities for use limited to blog or simple website
- No editor with formatting capabilities (not natively)
- Limited plugins that cannot be installed with a single click
- Initial setup not exactly trivial
As you were able to see Hugo, but static site generators in general, are suitable for those who have few demands from the point of view of plugins and adding functionality, but there is also to be said that themes are not limited to the graphical aspect (as is the case on Wordpress), but bring functionality to the site.
An example is the theme I use on this site, which for one supports search and light/dark mode switching.
On the other hand, it is also true that the initial setup is not trivial. The documentation is there, but in English and sometimes it is not exactly straightforward to find.
Credits: Icons created by Freepik - Flaticon