Hugo has a website and documentation. So the smartest way to install it is to follow instructions in the “open_in_new Install Hugo ” article.
But I like using Docker.
Commands
Build a website:
hugo
docker run --rm -it \
-v "$(pwd):/src" \
-u $(id -u):$(id -g) \
klakegg/hugo
Run a server:
hugo server
docker run --rm -it \
-v "$(pwd):/src" \
-u $(id -u):$(id -g) \
-p 1313:1313 \
klakegg/hugo \
server
Check version:
hugo version
docker run --rm -it \
-v "$(pwd):/src" \
-u $(id -u):$(id -g) \
klakegg/hugo \
version
Writing the site to disk
hugo server builds in memory. To write files for hosting, run:
hugo
Output goes to the public directory — that folder is the entire static site.
Cleaning
Hugo does not remove stale files from public. After renames or deletions, either wipe the folder:
rm -r public && hugo
or use:
hugo --cleanDestinationDir
Minifying
Strip whitespace from generated HTML/CSS/JS:
hugo --cleanDestinationDir --minify
Andrew Dorokhov