Moving to Vercel
This site is built with Hugo, and I decided to move it from Netlify to Vercel, for nosiness professional curiosity more than anything. It all went smoothly apart from one thing: syntax highlighting broke. The theme on live was different to production, and one code block was just put on the page as normal text, including the code fences. I couldn’t find the answer quickly so putting it here for future reference.
The fix was in two parts. First I added an environment variable in Vercel project settings called HUGO_VERSION
with the value of my local Hugo version. I got that from hugo -v
in my terminal app.
Next I created a vercel.json file in the project root with the following content, replacing x.xx.x
with my local version number.
{
"build": {
"env": {
"HUGO_VERSION": "x.xx.x"
}
}
}