I can't seem to build hugo in vercel

I’m new to hugo and getting the following error when buildling at vercel and netlify
it works fine building locally though

Building sites … ERROR 2024/01/20 20:31:20 render of “page” failed: “/vercel/path0/layouts/posts/single.html:28:18”: execute of template failed: template: posts/single.html:28:18: executing “content” at <.getterms>: can’t evaluate field getterms in type *hugolib.pageState

the code that errors is

          {{ with .GetTerms "authors" }}{{ partial "taxonomy/authors.html" . }}{{ end }}
          {{ with .GetTerms "categories" }}{{ partial "taxonomy/categories.html" . }}{{ end }}
          {{ with .GetTerms "tags" }}{{ partial "taxonomy/tags.html" . }}{{ end }}

I tried different casing still not working

The correct case is described in the docs:
https://gohugo.io/methods/page/getterms/

Somewhere in your templates, themes, or modules you have “getterms” (lowercase), which is wrong.

The .Page.GetTerms method was added in v0.65.0. With Vercel, I believe the default version is still v0.58.2, and with Netlify the default version is v0.85.0.

Make sure you are running the same version locally and remotely, hopefully the latest, v0.121.2.

2 Likes

There was a version issue in vercel. I resolved by adding the env variable to set hugo version.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.