# Do page resources work on /content/\_index.md

**URL:** <https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799>\
**Category:** support\
**Created:** [March 27, 2019, 10:59am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799 "2019-03-27T10:59:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Jeffery](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/james_jeffery/32/9594_2.png) [@James\_Jeffery](https://discourse.gohugo.io/u/James_Jeffery)\
**Post date:** [March 27, 2019, 10:59am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/1 "2019-03-27T10:59:55Z")

</div>

Can `/content/_index.md` contain resources?

I ask because I have multiple page bundles that are working fine with resources. I have `/content/window-cleaning-services/images`, and `/content/window-cleaning-services/index.md` that defines the resources in the frontmatter along with additional params such as alt tags etc. All that works fine, I can query the resources etc.

But when I try to do the same from `/content/_index.md` non of the images load.

Here I have a shortcode called `JobGallery`. When used it loads all `.png` images from any directory in t he bundle that contains the word `jobs`. In my case, for this project, such directories will only be used to display images of my clients work:

```
<section class="gallery">
    <div class="container">
    <h2 class="heading-2">{{ .Get "title" }}</h2>
    <p class="lead-2">{{ .Get "description" }}</p>
    {{ with .Page.Resources.Match "*jobs*/*.png" }}
    <ul class="row">
        {{ range . }}
        <li class="col-12 col-md-4 col-lg-3 gallery-item">
            <a class="lightbox" href="{{ .Permalink }}">
               <img src="{{ .Permalink }}" width="100%" title="{{ .Title }}" alt="{{ .Params.alt }}">
            </a>
       </li>
       {{ end }}
    </ul>
   {{ end }}
  </div>
</section>

```

In my `/content/_index.md` I define resources like so. Defining resources like this is an absolute pain but as I require extra data for the images I can’t see any other way to do this:

```
++++
[[resources]]
src="recent-jobs-in-birmingham/large-window-cleaning.png"
title="Title here"
    [resources.params]
    alt="Alt here"
....
+++
{{< JobGallery
    title="Our Recent Work"
    description="A description for lead text"
>}}

```

I have the images for the index page stored in `/content/recent-jobs-in-birmingham/`.

This doesn’t work on the `_index.md` page but works everywhere else on the site.

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [March 27, 2019, 11:18am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/2 "2019-03-27T11:18:14Z")

</div>

Hi,

As per the docs on [page bundles](https://gohugo.io/content-management/page-bundles/), allowed resources for branch bundles, ie those with `_index.md` can live

> Only in the directory level **of** the branch bundle directory i.e. the directory containing the `_index.md`

---

<div class="post-metadata">

**Author:** ![James\_Jeffery](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/james_jeffery/32/9594_2.png) [@James\_Jeffery](https://discourse.gohugo.io/u/James_Jeffery)\
**Post date:** [March 27, 2019, 11:18am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/3 "2019-03-27T11:18:58Z")

</div>

Is it possible to create a page bundle for the homepage?

---

<div class="post-metadata">

**Author:** ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)\
**Post date:** [March 27, 2019, 11:22am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/4 "2019-03-27T11:22:51Z")

</div>

If you mean a leaf bundle, I don’t think so. Making the `content/index.md` a leaf bundle means you can’t nest other pages under it.

You could create a headless bundle, `.GetPage` that, and put the resources meant for the homepage in there. There should be an example of headless bundles in the docs page I linked to above.

---

<div class="post-metadata">

**Author:** ![James\_Jeffery](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/james_jeffery/32/9594_2.png) [@James\_Jeffery](https://discourse.gohugo.io/u/James_Jeffery)\
**Post date:** [March 27, 2019, 11:24am UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/5 "2019-03-27T11:24:24Z")

</div>

I think the headless bundle could work for my usecase. Testing now.

---

<div class="post-metadata">

**Author:** ![James\_Jeffery](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/james_jeffery/32/9594_2.png) [@James\_Jeffery](https://discourse.gohugo.io/u/James_Jeffery)\
**Post date:** [March 27, 2019, 1:31pm UTC](https://discourse.gohugo.io/t/do-page-resources-work-on-content-index-md/17799/6 "2019-03-27T13:31:10Z")

</div>

Solved it with your help 🙂

```
<section class="gallery">
    <div class="container">
        <h2 class="heading-2">{{ .Get "title" }}</h2>
        <p class="lead-2">{{ .Get "description" }}</p>

        {{ $resources := cond .Page.IsHome (.Site.GetPage "recent-jobs-in-birmingham").Resources (.Page.Resources.Match "*jobs*/*.png") }}
        {{ with $resources }}
        <ul class="row">
            {{ range . }}
            <li class="col-12 col-md-4 col-lg-3 gallery-item">
                <a class="lightbox" href="{{ .Permalink }}">
                    <img src="{{ .Permalink }}" width="100%" title="{{ .Title }}" alt="{{ .Params.alt }}">
                </a>
            </li>
           {{ end }}
       </ul>
      {{ end }}
    </div>
</section>
```
