Issue
I recently started using Hugo shortcodes. Everything compiles and runs fine locally:
|
|
However, the build fails when deploying to Azure Static Web Apps via GitHub Actions:
|
|
Root Cause
Azure Static Web Apps uses Oryx as its default builder.
The Hugo version bundled with Oryx is v0.124.1, but my custom buymeacoffee
shortcode relies on features introduced in ≥ v0.146 (specifically named arguments for .Get
).
Because the version is too old, the shortcode cannot be parsed and the build aborts.
Solution: Tell Oryx to Use a Newer Hugo Version
Oryx looks at the environment variable HUGO_VERSION
to decide which version to install.
Add it to the existing “Build And Deploy” step in your GitHub Action:
|
|
Leave the other steps unchanged. Push your code again and the build and deployment should succeed ✅.
Takeaways
- The Hugo version bundled with Oryx is outdated.
- If your custom shortcodes depend on newer features, pin the Hugo version.
- You can switch versions quickly via the
HUGO_VERSION
environment variable without altering your existing CI/CD pipeline.