Error with partials in 0.75.0

Hugo v0.74.3 builds my site just fine, but Hugo v0.75.0 refuses to. Things like

{{- $content = partial "function/escape.html" $content -}}

that I use in several places start to produce errors like

execute of template failed: template: partials/function/content.html:17:15: executing "partials/function/content.html" at <partial "function/escape.html" $content>: error calling partial: partials that returns a value needs a non-zero argument.

I seem to be unable to parse the error message. What exactly became illegal in my syntax?

Sorry, should have read the release notes more closely. So, does this mean that I need to do the emptiness check every time I call these partials? Why?

Because the alternative would be much worse.

Before this, if you had a partial that returned something and you passed a zero value (e.g. 0 or “”) you would not get an error, but the partial would not be invoked.

… I will fix this, but I had to put in a error message in the meantime.

1 Like

I see, so what you’re saying is the partial was not being invoked anyway, and this way there’ll at least be some awareness of the fact and no hard-to-debug ruined expectations? Makes sense.

Yes, the bug report that triggered this was a user that used the example from the documentation (addInt) and tried to add … 0.

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