Automatic PRs for updating Hugo on Netlify
We’ve started using Netlify to deploy our static websites. It is just too easy. Probably the biggest reason why we like it is because of the automatic PR preview environments.
We’ve also been using Hugo for building our static sites. It’s a little bit ridiculous how many different static site generators are out there, but after all the ones we’ve tried, Hugo is the closest to how we want it to work.
Using Hugo on Netlify
To specify which version of Hugo you want, use the
HUGO_VERSION environment variable. In your
netlify.toml it might look something like this:
publish = "public"
HUGO_VERSION = "0.27"
The biggest reason this matters, is that you use the same version on your local machine as you expect Netlify to deploy with. They do change things between versions (obviously 😉), which can cause some unexpected behavior if you’re not using the same thing in development.
In our experience, the easiest way to manage this (especially if you’ve got multiple Hugo sites and/or developers) is to just stay up-to-date. So you use the latest version on your machine, and expect Netlify to do the same.
With dependencies.io, this can be pretty easy as it will tell you when there’s a new version available. Not only that, but in combination with Netlify, the pull request that dependencies.io opens will automatically be deployed to a preview site where you can make sure everything is working.
You can look at the repo for our www.dependencies.io site for the config files.
Dependencies.io can help you manage all of your dependencies. Completely free for open-source repos. Start getting pull requests for your dependencies👉