Hi,
There seems to be a sort of regression in the latest Hugo (I’m not sure if extractly 0.124 or later. But it’s not there in 0.123.8) but I want to double check I’m not doing anything stupid.
In one of the layouts I have the following code (warnf added to debug
{{ warnf "%[1]v %[2]v" $img (path.Join .Page.RelPermalink "og.png") }}
{{ $img = resources.Copy (path.Join .Page.RelPermalink "og.png") $img }}
{{ warnf "%[1]v %[2]v" $img .Permalink}}
With all pages, it went just fine with 0.123.8.
But one page is failing with the latest Hugo. I’m getting this in the build “logs”:
WARN /og_base.png /2024/open-graph-hugo/
WARN <nil> https://blog.lanzani.nl/2024/open-graph-hugo/
[...]
Error: error building site: render: failed to render pages: render of "page" failed: "..../themes/hugola/layouts/_default/single.html:1:3": execute of template failed: template: _default/single.html:1:3: executing "_default/single.html" at <partial "header.html" .>: error calling partial:
".../themes/hugola/layouts/partials/header.html:7:7": execute of template failed: template: partials/header.html:7:7: executing "partials/header.html" at <partial "opengraph.html" .>: error calling partial:
".../themes/hugola/layouts/partials/opengraph.html:81:43": execute of template failed: template: partials/opengraph.html:81:43: executing "partials/opengraph.html" at <$img.Permalink>: nil pointer evaluating resource.Resource.Permalink
So basically $img is set (first line), but it becomes nil when doing the resources.Copy,
The fact it only fails with one page is fishy. I’ve reverted to 0.123.8, and everything is OK.
Thoughts?