Shortcode not loading page resources

I’m trying to create a shortcode that ranges through any images from the page resources and displays them. My code is below:

<div class="gallery">
        {{ range .Page.Resources.Match "**.png" }}
            <a href="{{ .RelPermalink }}">
                <img src="{{ .RelPermalink }}">
        {{ end }}

I include this into like so:

{{< gallery >}}

Within the frontmatter of I have the following resources defined:

    src = "featured-work/1.png"
    title = ""

    src = "featured-work/2.png"
    title = ""

    src = "featured-work/3.png"
    title = ""

Within content I have a featured-work directory that contains the images.

The gallery code is being loaded into the html source but the list is empty.

Any idea what I’m doing wrong?

A little hard to say without the full context, but is your content a bundle, e.g.

The content is in an at the root of /content. This is for the homepage. A branch bundle I believe.

OK, then I see. We may lift this limitation – but currently branch bundles is 1 level only. So, if you move your images from featured-work and up to the root, it will work.

Perfect @bep! Works. I was scratching my head for a while.