Project
hugo new site <name>
Create a new site skeleton
hugo new site <name> --format yaml
Use YAML (or json) config
hugo new site . --force
Initialise in a non-empty folder
hugo new theme <name>
Scaffold a theme in themes/
git submodule add <url> themes/<name>
Install a theme as submodule
Then set theme = '<name>' in hugo.toml.
hugo version
Show the installed version
hugo env
Show version and Go/OS info
hugo config
Print the merged site config
hugo config --format yaml
Print config as yaml or json
hugo config mounts
Print the file mounts
Content
hugo new content <path>
Create a page from an archetype
hugo new content posts/<name>.md
Add a post
hugo new content -k <kind> <path>
Force an archetype kind
hugo new content --editor <ed> <path>
Open it in an editor
hugo list drafts
List draft pages
hugo list future
List pages with a future date
hugo list expired
List expired pages
hugo list published
List pages that will be built
hugo list all
List all pages, any state
hugo convert toYAML
Convert front matter to YAML
Also toTOML and toJSON. Writes in place unless -o is set;
commit first.
hugo convert toTOML -o <dir>
Convert into another directory
Dev server
hugo server
Serve and live reload
hugo server -D
Include drafts
hugo server -F
Include future-dated pages
hugo server -p <port>
Listen on another port
hugo server --bind 0.0.0.0
Reachable from other devices
hugo server --bind 0.0.0.0 -b http://<ip>:1313
Phone test with matching baseURL
hugo server -N
Jump to the changed page
hugo server -O
Open the browser on start
hugo server --disableFastRender
Full rebuild on each change
hugo server --navigateToChanged --noHTTPCache
Avoid stale browser cache
hugo server --renderToMemory
Do not write to disk
hugo server --poll 700ms
Poll files (network drives)
hugo server --tlsAuto
Serve HTTPS locally
Run hugo server trust once to install the local CA.
Build
hugo
Build the site into public/
hugo --minify
Minify HTML, CSS, JS, XML
hugo -d <dir>
Write to another directory
hugo -b <url>
Set the base URL
hugo -s <dir>
Build a site elsewhere
hugo --gc
Remove unused cache files
hugo --cleanDestinationDir
Remove stale files from output
hugo -e <env>
Pick the environment
hugo --enableGitInfo
Use git for lastmod and author
hugo --logLevel info
Set log verbosity
hugo --quiet
Hide non-error output
hugo --panicOnWarning
Fail on the first warning
hugo --templateMetrics
Show template timings
hugo --printPathWarnings
Warn on duplicate target paths
hugo --printUnusedTemplates
Warn about unused templates
hugo --ignoreCache
Skip the resource cache