Hugo 0.56.0: Hugo Modules and Deployment

Tags: #<Tag:0x00007f73785b3680> #<Tag:0x00007f73785b3388>

Hugo 0.56.0 is filled with improvements, but there are two main headliners: Hugo Modules and Hugo Deploy .

Hugo Deploy is implemented by @vangent and brings built-in deployment support for GCS, S3, or Azure using the Hugo CLI. See the Hugo Deploy Documentation for more information.

Hugo Modules is very much a community effort on the design and specification side, but @bep has driven the implementation. Some notes about what all of this is about:

  • A new module configuration section where you can import almost anything. You can configure both your own file mounts and the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in configDir , staticDir etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the SCSS folder in the Bootstrap GitHub project.
  • A module consists of a set of mounts to the standard 7 component types in Hugo: static , content , layouts , data , assets , i18n , and archetypes . Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
  • Modules not in your local file cache will be downloaded automatically and even “hot replaced” while the server is running.
  • Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
  • A new set of CLI commands are provided to manage all of this: hugo mod init , hugo mod get , hugo mod graph , hugo mod tidy , and hugo mod vendor .

Hugo Modules is powered by Go Modules.

This is all very much brand new and there are only a few example projects around:

See the Hugo Modules Documentation for more information.

Well this is super exciting! Just as I’m deploying a bunch of Hugo sites, too! Time to deep dive on this, but I"m been waiting for modules, it’s gonna be cool!

Number 1 reason I’m excited?! I can keep game rules in version control and load as a module to build my campaign, all math involved, ready to publish as a web document.

I’ll show you…

Oh… I have a second reason to be excited, and while not as fun, a thing I should probably do: build my invoice system.

This is a bug-fix release with a couple of important fixes.

This is a bug-fix release with a couple of important fixes.

Also noting:

This is a bug-fix release with a couple of important fixes. After getting feedback about the new Hugo Modules feature, this release also adds some minor improvements:

It adds support for overlapping file mounts, even for the filesystems where we walk down the directory structure. One relevant example that is fixed by this release:


The above is obviously both common and very useful. This was never an issue with the situations where you load a specific file/directory (e.g. resources.Get "a/b/c/d/sunset.jpg" ).

User feedback also told us that these file mounts were a little hard to debug, so we added a new command that prints the configured mounts as a JSON:

hugo config mounts

The mounts feature has undergone a lot of feedback and testing over the last week, and bep has been on top of this. :slight_smile: