Hugo: Create static sites in a flash

Published by TheJoe on

Estimated reading time: 2 minutes

Hugo is one static site generator: a software that takes text files (in markdown format) and transforms them into a complete website into HTML. It does not require databases or server-side languages: Everything is generated locally and can be hosted everywhere, The Github pages netlify.

It's written in Go and is famous for one thing in particular: the speed. Hugo can regenerate an entire site with thousands of pages in less than a second.

Why use it?

  • Zero dependencies: non serve PHP, né database, static files only.
  • Build rapidissime.
  • Ready themes and easily customizable.
  • Write in Markdown, think about the contents.
  • Great for SEO: clean and lightweight code.

Installation

sudo apt install hugo  # Questo comando installa la versione base di Hugo

Or download the binary from the official website: https://gohugo.io.

Please note: if you use Linux you should download the binary from the official site (Hugo Extended). This way you will have SCSS support and will also be able to use the most advanced themes. Once you have downloaded the archive from the project's git, simply extract and copy the binary hugo in /urs/local/bin and run it as if you had performed a standard installation.

How to use it?

hugo new site mio-sito
cd mio-sito
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo 'theme = "ananke"' >> config.toml

Create on the first page:

hugo new posts/ciao-mondo.md

Edit the file with your favorite editor, then start the local server:

hugo server

Open your browser to http://localhost:1313: your site is already there!

Limits?

  • Not suitable for sites with dynamic features (login, Comments, e-commerce).
  • It may take some practice to master the structure of the themes.
Look here:  Print in a series of addresses from a database with OpenOffice Writer and Base

Conclusions

Hugo is the ideal tool for those who want a site fast, secure and easy to maintain. Perfect if you write often, if you work with Markdown or if you want a sleek site without wasting time with the backend.

Follow-up

Today we saw a brief overview of what Hugo can do. In the next article I will show you how to create a small site in this way simple and fast: we will see some of the syntax to use in the files .md and you will be able to establish a starting point to begin to delve deeper into the topic.


TheJoe

I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.