Setup
My page bundle:
content
└── contact
├── index.md
└── photo.jpg
index.md:
---
title: Contact
description: Where to find me
---
# Header
paragraph of text
![Photo](photo.jpg "Some nice photo")
I’m using a markdown render hook to process any inline images:
{{ $I := .Page.Resources.GetMatch .Destination }}
This works fine, and the image object can be queried for its properties.
Issue
If however, I invoke a method on the image:
{{ $I := .Page.Resources.GetMatch .Destination }}
{{ $S := $I.Resize "100x" }}
I get:
execute of template failed: template: _default/_markup/render-image.html:2:19: executing "_default/_markup/render-image.html" at <$I.Resize>: nil pointer evaluating resource.Resource.Resize
There are several topics with a similar error, but none resolved, at least not in a way that brings me forward.
Any help welcome, right now that’s a showstopper for me.
Update
This seems to be one of those sporadic failure cases that I tend to run into with Hugo. Sometimes it works, sometimes it doesn’t. If I empty the template, start the server, then reinstate the template, it works! But that’s misleading I think; Hugo cannot find the image from a cold start it seems.
If my way of fetching page resources is flaky, let me know!