LinuxCommandLibrary

hugo

Generate static websites from source files

TLDR

Create a new Hugo site

$ hugo new site [path/to/site]
copy

Create a new Hugo theme (themes may also be downloaded from )
$ hugo new theme [theme_name]
copy

Create a new page
$ hugo new [section_name]/[page_name]
copy

Build a site to the public directory
$ hugo
copy

Build a site including pages that are marked as a "draft"
$ hugo [[-D|--buildDrafts]]
copy

Build a site on your local IP
$ hugo server --bind [local_ip] [[-b|--baseURL]] [http://local_ip]
copy

Build a site to a given directory
$ hugo [[-d|--destination]] [path/to/destination]
copy

Build a site, start up a webserver to serve it, and automatically reload when pages are edited
$ hugo server
copy

SYNOPSIS

hugo [subcommand] [flags]

PARAMETERS

-b, --baseURL string
    hostname (and path) to site root, e.g., https://example.org/

-c, --cleanDestinationDir
    remove all files from destination before building

--config stringArray
    config files (default: config.yaml)

--debug
    enable debug output

-d, --destination string
    filesystem path to write output files

-D, --buildDrafts
    include draft content when building

-E, --buildExpired
    include expired content

-F, --buildFuture
    include future-dated content

--logLevel string
    set log level: debug|info|warn|error (default: info)

--minify
    minify HTML, CSS, and JS output

-q, --quiet
    suppress console output

-s, --source string
    source directory (default: current)

--themesDir string
    path to themes directory

-v, --verbose
    enable verbose output

-h, --help
    show help

--version
    print Hugo version

DESCRIPTION

Hugo is an open-source static site generator built with Go, renowned for its blazing speed and flexibility. It converts Markdown, reStructuredText, or AsciiDoc content into fully functional static websites, capable of building thousands of pages in seconds. Ideal for blogs, portfolios, documentation, and corporate sites, Hugo features a rich ecosystem of over 300 themes in its official gallery. Key strengths include live reloading with hugo server, support for taxonomies, menus, shortcodes, and headless CMS integrations. Sites are secure, CDN-ready HTML/CSS/JS with no runtime dependencies. Configuration via YAML/TOML/JSON archetypes enables customization, while Hugo Pipes and asset processing streamline workflows. Widely used by companies like Cloudflare and DigitalOcean for its performance and simplicity.

CAVEATS

Not included in standard Linux distros; install via binaries, Snap, APT, or package managers. Large sites may require memory tuning.

COMMON SUBCOMMANDS

hugo server - development server with live reload
hugo new path - create new content file
hugo build or plain hugo - generate production site

CONFIGURATION

Uses config.yaml, config.toml, or config.json in site root for settings like baseURL, theme, and menus.

HISTORY

Created by Steve Francia (spf13) in 2013 as a faster Go-based alternative to Jekyll. Handed to Bjørn Erik Pedersen in 2015; now maintained by gohugoio team. Milestones: v0.14 (2014, subcommands), v0.55 (2018, Hugo Pipes), v0.120+ (2023, asset handling). Used by millions, powers sites like DigitalOcean docs.

SEE ALSO

git(1), rsync(1), pandoc(1), make(1)

Copied to clipboard