Using Hugo

Using Hugo

This Quick Reference focusses on the command line usage of hugo. It’s based on my own experience and usage of the command. The reference guide for the command line can be found on the Hugo website. Most frequently used commands are on top.

Content management commands

new is the base command used to create new content. Requires additional commands and parameters for a new site, new theme or new content.

$hugo new site name-of-site
$hugo new path-to-content/
$hugo new quickref/
/Users/dirk/OneDrive/HUGO/Sites/ created

server launches the built-in webserver. Watches changes and automatically refreshes content. Launch with the -D or –buildDrafts to process pages with the draft flag.

$ hugo -D server
Started building sites ...
Built site for language en:
7 of 7 drafts rendered
0 future content
0 expired content
7 regular pages created
20 other pages created
0 non-page files copied
8 paginator pages created
3 tags created
1 categories created
total in 28 ms
Watching for changes in /Users/dirk/OneDrive/HUGO/Sites/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address
Press Ctrl+C to stop

Admin commands

list lists .md files based on their status: drafts, expired, future. Gives an overview of the pages that are not published. Used for housekeeping.

$hugo list drafts
$hugo list expired
$hugo list future

help shows the help page with all the commands or help on a specific command. There is no man page for hugo. version shows the version of hugo. env prints the environment.

$hugo help
$hugo --help
$hugo command --help 
$hugo version
Hugo Static Site Generator v0.27.1 darwin/amd64 BuildDate: 2017-09-16T01:16:32+02:00
$hugo env
Hugo Static Site Generator v0.27.1 darwin/amd64 BuildDate: 2017-09-16T01:16:32+02:00

benchmark does a quick performance test, handy to check if everything works. config prints out the configuration of the site (includes all vars).

$hugo benchmark
$hugo config