Installing Hugo

By: Dave Walsh

         hugo · installation      hugo · installation      hugo zero to hero

Estimated reading time: 2 minutes

Mac

Installing on a mac could not be easier with brew. If you do not have brew installed you can follow the instructions at https://brew.sh/

Step 1 install hugo via brew:

brew install hugo

and abracadabra thats it!

other platforms

To install hugo using windows or linux head to https://gohugo.io/getting-started/installing/ to see the detailed instrauctions.

Config file

This file is essential to getting your hugo site set up correctly. There are so many possible variables to use it is impossible to include them in one tutorial. the ones I use are:

contentDir = "content"
layoutDir = "layouts"
publishDir = "public"
buildDrafts = false
canonifyURLs = true
baseURL = "/"
languageCode = "en"
title = "Learn HUGO"

[taxonomies]
  category = "categories"
  tag = "tags"

[params]
  subtitle = "For me to learn HUGO!"
  author = "DAVE WALSH"

The contentDir variable explicitly tells hugo what folder i want content to be held in. this is actually automatically done buy hugo and the variable is not needed but it is good to be explicit, just incase you wish to change this in future.

The layoutDir variable defines the place of the templates. Again it is not needed to set this.

The publishDir variable sets the folder for where the rendered site is published to.

The buildDrafts variable is a switch to allow hugo to build pages in draft mode which you control with a varaible in each pages front matter.

The baseUrl is a required variable. For local builds I use “/” but then change to the full uri of the website once placed live.

The languageCode sets the language encoding that is used on the meta of each page.

The title is the last of the required variables and is the title of your site.


Part 3 of 15 in the hugo zero to hero series.

Series Start | static pages | Creating Static Pages