The purpose of this article is to demonstrate the first steps in creating a website in Hugo, so don’t expect anything too advanced, as the focus is for those who have never seen it working.
Installation
We will cover installing on GNU/Linux systems, more precisely, using Snaps packages on Gentoo Linux. It’s a very easy method that helps to keep Hugo always up to date and working without any additional configuration.
To learn how to install snaps in Gentoo, click here.
Okay, let’s get to the process!
1° – Accessing the terminal
To install, open the terminal application, in this case I’m using the Gnome Shell and the default program, gnome-terminal or simply “terminal”.
With it open, type the following command:
sudo snap install hugo
Wait for the installation to finish and check the Hugo version:
hugo version
With successful installation, it’s time to start the site.
2° – Creating your first site
Create a folder called Sites in the home:
mkdir $HOME/Sites
Go to the folder:
cd $HOME/Sites
Create the first project:hugo new site my-first-project
Open the $HOME/Sites
folder in your preferred text editor, such as [Gedit](https://wiki.gnome.org/ Apps/Gedit “Gnome Text Editor”) or Atom, for example. I used the nano.
In this first moment, we will only perform the necessary settings for the site to be minimally accessed. So the next step is to look for and download a template for our project. Go to this link or use git.
git clone https:https://github.com/thomasheller/crab.git
For the theme to work, move the “crab” folder to the $HOME/Sites/my-first-project/themes/
directory, like this:
$ mv crap $HOME/Sites/my-first-project/themes/
To test the site, access your project’s root folder:
n$ cd $HOME/Sites/my-first-project
With the text editor, open the config.toml file and type the following line:
theme = "crab"
Again in the terminal, type:
$ hugo server
Open your browser and access the address http:https://localhost:1313 and your site will be working and you don’t even need Apache installed on the machine.
3° – Customizing and configuring
Now, with your code editor of choice, open the config.toml file. It is there that the main settings will be made, such as the definition of the base URL of the site, definition of the chosen theme, title, among many others.
To get started, it’s important to read Hugo’s documentation and follow the sequence of blog articles. The next one will be about the main site settings, don’t miss it.