2.1 Jürgen's Notebook

I use HUGO together with the RELEARN theme to create this website.

Install HUGO

To install HUGO just call:

sudo apt install hugo

Initial Setup of the Website

Note

Visit HUGO Quick Start and RELEARN Documentation for a detailed introduction.

In your home directory you can create a new directory, e.g. hugo and then move in this directory.

mkdir ~/hugo
cd ~/hugo

Git is used for version control which is normally already installed on your server. To create the website with the RELEARN theme you need to execute following commands:

hugo new site <your_site_name>
cd <your_site_name>
git init
git submodule add --depth 1 https://github.com/McShelby/hugo-theme-relearn.git themes/hugo-theme-relearn
echo "theme = 'hugo-theme-relearn'" >> hugo.toml
hugo server

With the last command hugo server a webserver is started. Open http://localhost:1313 with your web browser to see your website. With CTRL+C you can stop the webserver.

Simply calling hugo will create a static version of the website in the folder ~/hugo/public/<your_site_name>. This folder will later be used by Caddy to provide the website to your audience.

It is recommended to create a .gitignore file to exclude files in the directory, that are created by Hugo:

# ---> Hugo
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json

# Temporary lock file while building
/.hugo_build.lock

Caddy Setup

The static website content is now available in the directory ~/hugo/public/<your_site_name>. I assume you have created the domain website.example.com that can be used for providing the website on the internet.

Note

For a detailed documentation pleaser refer to the Caddy website.

Now you need to add following lines in the file /etc/caddy/Caddyfile:

website.example.com {
    root * /home/<your_username>/hugo/<your_site_name>/public
    file_server
}

With following commands Caddy will read the new configuration and you can check for the status:

cd /etc/caddy
sudo caddy reload
sudo service caddy status

Caddy will serve the contents in ~/hugo/public/<your_site_name> as website with the address https://website.example.com. An SSL certificate will be assigned and updated automatically.