Static web site with Hugo

In web development, a static page is a web page that does not require a web server to be served and do not require any preprocessing, it is just served verbatim from the container folder. They offer advantages in loading and caching speed. And even security, since there are no way of edit the files unless the server access is compromised (and you will have worse implications).

Hugo is a great web site static generator written in Go. It is amazingly fast and features hot reloading triggered when the content or the layout change. Hugo divides the web site in three main components: the content, the taxonomies, and the layouts or themes. The taxonomies are just different types of content, with a defined structure. For example, a blog could feature a post taxonomy, a photographer site could feature a gallery and campaign taxonomies, etc. If you have worked with CMS such as WordPress, the taxonomies are basically the same as post types.

Following the analogy with WordPress CMS, the Hugo layouts are the WordPress themes. They even have a similar API: a loop to filter the taxonomies and iterate over them, and a hierarchy of containers, i.e. the layout can be divided in components to be re-used in different sections.

Finally, the content. By default, Hugo uses markdown as content format, and then convert it to HTML. Once the taxonomies, the layouts and the content is in place, Hugo can generate the whole static site with only one command: hugo, and it will create all the required files in the public folder. Really easy and really fast.

A bonus is that a static web site can be hosted with GitHub pages, so you can have your static site for free. You can even have your own personal domain name, but unfortunately, GitHub pages does not yet support SSL certificates for your personal domain name. But, you can always host your site in your private machine easily with services as AWS or DigitalOcean.

Hey, what about a static site generator using web components? Where you could use React for example?