This repository is a DDEV add-on for providing Hugo support.
In DDEV addons can be installed from the command line using the ddev add-on get command, as in ddev add-on get penyaskito/ddev-hugo.
- Create your ddev project with
ddev config --omit-containers=db --docroot public - Run
ddev add-on get penyaskito/ddev-hugo - Run
ddev hugo - Run
ddev launch
The add-on installs a ddev hugo command, so Hugo can be run directly rather
than through ddev exec hugo:
ddev hugo version
ddev hugo new site . --force
ddev hugo new content posts/hello.md
ddev hugoFlags are passed straight through to Hugo, the command runs in the container
directory matching your current host directory, and generated files (such as
public/) are synced back to the host.
ddev hugo server starts Hugo's live-reload server and is reachable from the
host, on port 1313 over HTTPS and 1314 over HTTP:
ddev hugo serverddev describe lists the URL under hugo. The command supplies --bind,
--port, --baseURL and --appendPort so the server listens on an address
the DDEV router can reach and generates links pointing at the routed URL.
Passing any of those flags yourself overrides the default, and setting
HUGO_SERVER_PORT changes the port the command uses.
Everything else is passed through, so the usual flags work:
ddev hugo server --buildDrafts --disableFastRenderHugo (extended edition) is installed from the official releases
during the web container build. To use a different release, edit HUGO_VERSION
in .ddev/web-build/Dockerfile.ddev-hugo and run ddev restart.
Remove the #ddev-generated line at the top of that file to keep your changes
from being overwritten the next time you run ddev add-on get.
Contributed and maintained by @penyaskito