Hugo Cheat Sheet
Useful Hugo commands params
Page content
Hugo is a static website generator. It helps produce html from markup, theme and keep website organised. Like this tech blog. Here’s a list of the most useful Hugo commands with their parameters:
Site Creation and Management
- Create a new site:
hugo new site <site-name> -f yml
- Create new content:
hugo new <content-path>
- Build site:
hugo
- Build site including draft content:
hugo -D
- Serve site locally:
hugo server
- Serve site with draft content:
hugo server -D
Content Management
- Add a new post:
hugo new posts/<post-name>.md
- Add a new page:
hugo new <page-name>.md
Theme Management
- Add a theme:
git submodule add <theme-repo-url> themes/<theme-name>
- Use a theme: Add
theme = "<theme-name>"
to config.toml
Build Options
- Specify output directory:
hugo -d <directory>
- Build with base URL:
hugo -b <URL>
- Minify output:
hugo --minify
Server Options
- Specify port:
hugo server -p <port-number>
- Bind to specific IP:
hugo server --bind <ip-address>
- Watch for changes:
hugo server -w
- Disable live reload:
hugo server --disableLiveReload
Debugging
- Verbose output:
hugo -v
- Log levels:
hugo --log-level <level>
(debug, info, warn, error)
Utility Commands
- Version check:
hugo version
- Clean build cache:
hugo --cleanDestinationDir
- List all pages:
hugo list all
- Print site configuration:
hugo config
Replace placeholders (enclosed in < >) with actual values when using these commands.
Hope this helps.
Useful links
- Deploy Hugo-generated website to AWS S3
- Submit Google Form in Hugo Website
- Markdown Cheatsheet
- Adding Structured data markup to Hugo
- Images handling in Mainroad Hugo Theme: Mainroad theme image handling
- Hugo - a static website generator.