Closed pleasantone closed 9 months ago
Update:
Happens when .Page for this short-cut is nil. Looks like we cover it with
$page = default page .Page
in image.html
why is .Page nil when it was just fine when being called one step up by the bootstrap bs/img shortcut pulling in the data file?
WARN page=Page(/_index.en.md) .Page=<nil> $page=Page(/_index.en.md)
WARN looking for page resources getmatch path=attendees/mug_mattgor.jpg page=Page(/_index.en.md) res=<nil>
WARN image not found: attendees/mug_mattgor.jpg
Scenario:
I use
{{< bs/img-grid "attendees.yaml" >}}
to build an image grid of photos of people attending an event on a page. The images are stored in the page bundle, in a subdirectory e.g.attendess/foo.jpg
.Anomaly: Page always builds correctly in production. Sometimes, in development, e.g. if one edited that page bundle's index.md, the images are not found. If one triggers a rebuild, they will often be found.
github.com/hugomods/images/layouts/partials/images/image.html
reports that the images that were part of the page resources was not found.Analysis: By adding some debugging, I've determined that when things have failed, it has occurred because
image.html
's $page variable isPage(/_index.md)
notPage(/events/2024-baja-mexico/index.md)
(the proper page).Strongly enough, the call to
GitHub.com/hugomods/bootstrap/layouts/partials/bootstrap/img-grid.html
(one level up in the call stack) is always called with the proper Page set.Here's my debugging output when it fails:
Here is my debugging when it succeeded:
My best guess is that something is partialCached when it shouldn't be, but this is really weird.. the page in question is just using a standard shortcut...
Full source code at https://github.com/goattrails/hb-goattrails/blob/main/content/events/2024-baja-mexico/index.md
My debugging diffs: bootstrap.patch images.patch