GoHugo Cheatsheet

Commands

Quick References

CommandDescription
npm run devRun the hugo development envrionment locally
hugo new content/docs/cheatsheets/{name}.mdCreate a new cheatsheet
hugo new content/blog/{section}/{name}.mdCreate a new blog

Common Hugo Commands

CommandDescription
hugo new site <site-name>Creates a new Hugo site with the specified name.
hugo new <content-path>Creates a new content file at the specified path.
hugo new posts/my-first-post.mdCreates a new blog post in the posts directory.
hugo serveStarts a local server and rebuilds the site on file changes.
hugo serve -DServes the site including draft content.
hugoBuilds the static site in the public/ directory.
hugo -DBuilds the static site, including draft content.
hugo server --watchWatches for changes and automatically rebuilds the site.
hugo server --disableFastRenderServes the site with all pages fully rendered, useful for debugging.
hugo configPrints the current Hugo configuration.
hugo envPrints Hugo environment information, including version and OS details.
hugo versionDisplays the current Hugo version.
hugo list draftsLists all draft content.
hugo list futureLists all future content (posts with future publish dates).
hugo list expiredLists all expired content (posts with past expiration dates).
hugo gen autocompleteGenerates shell autocompletion script.
hugo gen docGenerates Hugo documentation.
hugo deployDeploys the site using the configuration defined in config.toml.
hugo mod init <module-path>Initializes a new Hugo module.
hugo mod getDownloads the dependencies for the current Hugo module.
hugo mod tidyCleans up unused module dependencies.
hugo server -t <theme-name>Starts a local server using a specific theme.