QuickTip: Matching the local version of Hugo on AWS Amplify

When using Hugo to generate a static website it is quite important to match the Hugo versions locally with the version used by AWS Amplify.

If you don’t you can end up in a situation where for example syntax highlighting is working fine locally, but isn’t working on the deployed site. This happened to me, and this is how I fixed it.

  1. Open your AWS Amplify deploy project and choose «Build Settings» from the left menu.
  2. Scroll all the way down to «Build image settings» and click the edit button on the right side.
  3. Add a package version override
    1. Select “Hugo” as the package
    2. The version should be set to “latest” (or the version you prefer).
    3. Save

Now Amplify will use the version of Hugo you specified for all future builds. You’ll need to trigger a new build for any changes to your site to take effect.

PS: Remember to keep your local version of Hugo updated to the same version you selected in the Amplify console.