Hugo Cheatsheet

Hugo Cheatsheet A quick reference for the most useful Hugo commands, flags, and tips. Core Commands Command Description hugo new site <directory> Create a new Hugo site in the specified directory. hugo new <section>/<filename>.md Add a new content file (e.g., hugo new posts/my-first-post.md). hugo server Run a local development server with live reload (defaults to http://localhost:1313). hugo server -D Include drafts (draft: true) when serving locally. hugo Build the site for production (outputs to public/). hugo -d <output-dir> Specify a custom output directory for the generated site. hugo --minify Minify HTML/CSS/JS during the build for smaller payloads. hugo --gc Run garbage collection to remove unused files from the cache. hugo version Show the installed Hugo version. hugo env Display environment variables (useful for debugging). Useful Flags & Options Flag Purpose -s, --source <path> Set the working directory (useful when running from outside the site root). -b, --baseURL <url> Override the site’s base URL (good for staging environments). -t, --theme <name> Force a specific theme (overrides the one set in config.toml). --cleanDestinationDir Delete everything inside the destination folder before building. --ignoreCache Skip the cache and reprocess all files (helps when you suspect stale data). --verbose Show detailed processing information (great for troubleshooting). --logLevel <level> Control log output (debug, info, warn, error). Content Management Tips Front Matter ...

January 16, 2026