KINDERAS.COM

Tue Jun 09 2020

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.

  • Open your AWS Amplify deploy project and choose «Build Settings» from the left menu.
  • Scroll all the way down to «Build image settings» and click the edit button on the right side.
  • Add a package version override
    • Select "Hugo" as the package
    • The version should be set to "latest" (or the version you prefer)
    • 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.

References