Hugo Partial Not Rendering Once Deployed to Netlify

I seem to be having issues with getting a specific Hugo partial to render once my site is deployed to Netlify. There are no build errors in Netlify, and locally the partial renders without issues. All other content, including UI that’s rendered via partials, displays once deployed to Netlify.

I’ve unsuccessfully tried troubleshooting by:

  • Changing partial name
  • Simplifying code within partial (ex: not include image)
  • Updating Hugo $baseURL with netlify URL
  • Updating Hugo production env variable

Site URL:
Hugo Partial:
<article class="card"> <a href="{{ .Permalink }}"> <div class="card__image"> {{ with $.Page.Resources.GetMatch "*" }} {{ partial "components/image.html" . }} {{ end }} </div> <div class="card__header"> <h2 class="card__title">{{ .Title }}</h2> </div> <div class="card__footer"> <ul class="card__list"> {{- range $i, $e := .Params.specialties -}} {{- if $i -}}, {{ end -}} <li class="card__list-item">{{ . | title }}</li> {{- end -}} </ul> </div> </a> </article>

Netlify config:
command = “hugo -b $URL && npm run build”
publish = “public”
functions = “functions”

HUGO_VERSION = “0.58.3”

HUGO_ENV = “production”
NODE_ENV = “production”

command = “hugo -b $DEPLOY_PRIME_URL”

command = “hugo -b $DEPLOY_PRIME_URL”

Local Screenshot:

Netlify Screenshot:

What is your local Hugo version?

local version is v0.55.6/extended darwin/amd64

I’m wondering if it could be the way I’m calling the partial that’s problematic inside of Netlify?

{{ range where .Site.RegularPages "Section" "trainers" }}
  {{ partial "components/card" . }}
{{ end }}

Nope — that wasn’t it :frowning:

is it a case issue?

Can you give this a read through and let us know if that fixes the issue?

I found the solution. It’s related to error 255 status b/c the HUGO_VERSION environment variable did not match what I was running locally. I had trouble figuring this out b/c I never got an actual build error in Netlify. I updated this env variable it in Netlify Settings and it worked like a charm.

For those encountering the same issue, this documentation is helpful: [Support Guide] Frequently encountered problems during builds

1 Like

Thanks for following up @perry. I looked into this and it appears it’s not case-related.

I managed to find a fix: while I did not get an error during build on Netlify, the problem was resolved once I changed the HUGO_VERSION variable to match the version of my local build. This is related to error 255 status.

For those that encounter the issue, this documentation is helpful: [Support Guide] Frequently encountered problems during builds