I’m new to Hugo, and I can’t work out which bit of what I’ve done is wrong, so it’s difficult to search for an answer.
While hugo server was running, I put the following into a post template:
{{ $mainimg := .Page.Resources.GetMatch "mainimg.*" }}
{{ $thumb := $mainimg.Resize "400x" }}
<a href="{{ $mainimg.RelPermalink }}">
<figure class="">
<img src="{{ $thumb.RelPermalink }}" width="{{ $thumb.Width }}" height="{{ $thumb.Height }}">
</figure>
</a>
and it worked perfectly.
But if I restart hugo server, or just run hugo, I get the following error:
Error: Error building site: failed to render pages: render of "page" failed: "/home/chris/projects/hugo/qs4/layouts/preview/single.html:36:27": execute of template failed: template: preview/single.html:36:27: executing "main" at <$mainimg.Resize>: can't evaluate field Resize in type resource.Resource
Can anyone give me a clue?
