Reuse images in page bundles in homepage from a shortcode

With a content layout like:


Refrencing an image in a shortcode works nicely in pagedir/ but how can I reference image.jpg when calling a shortcode in Is it possible yet?

I feel like I should just be able to do this in the shortcode
{{ $src := .Resources.Match (printf "*%s*" (.Get "src")) }}
And in home page do:
{{< figure-imgsrc src=“pagedir/image.jpg” >}}
But I get the impression from an hour of reading that it’s not currently possible.

Failing that how can I keep several images available for the homepage without just messily dropping them into content/ or treating them as assets? (They really are just home page content.)
I want to process the images in a shortcode too.


Yes, this is the case for a branch bundle:

Where can the Resources live? Only in the directory level of the branch bundle directory i.e. the directory containing the

You just need to copy your image to /content/.

Had tried that, it didn’t work - I’ll take a closer look at my shortcode, try the built in one with that path.

Still think dropping a bunch of images in at the top level of content feels messy :slight_smile:

Turns out I had a curly quote instead of a straight quote at the end of src declaration in :sob:

All solved. Marked your answer as a solution anyway @Grob since it is correct :slight_smile:

1 Like