# Retrieving page resources in html page layout

**URL:** <https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853>\
**Category:** support\
**Created:** [August 27, 2020, 1:52am UTC](https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853 "2020-08-27T01:52:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperSonicSites](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/supersonicsites/32/11320_2.png) [@SuperSonicSites](https://discourse.gohugo.io/u/SuperSonicSites)\
**Post date:** [August 27, 2020, 1:52am UTC](https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853/1 "2020-08-27T01:52:16Z")

</div>

Hi, I’m having issues here.  
My homepage is mostly layout and front matter.

Folder looks like this:

```auto
content/
└── home
       └── index.md
       └── test.jpg

```

I went on to add this code to home.html (layout):

```auto
{{ with .Resources.Match "test.jpg" }}
   <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{end}}

```

The error I’m getting is this:

```
ERROR 2020/08/26 21:50:18 Failed to render pages: render of "page" failed: "C:\Users\renau\OneDrive\Documents\Websites\Framework\layouts\_default\home.html:27:17": execute of template failed: template: _default/home.html:27:17: executing "main" at <.RelPermalink>: can't evaluate field RelPermalink in type resource.Resources
```

---

<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:** [August 27, 2020, 2:09am UTC](https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853/2 "2020-08-27T02:09:11Z")

</div>

> [@SuperSonicSites](#):
>
> ```auto
> {{ with .Resources.Match "test.jpg" }}
> 
> ```

`.Resources.Match` will return an array: [Page resources | Hugo](https://gohugo.io/content-management/page-resources/#methods)

You have to `range` over the result beforeaccessing the `.RelPermalink`.

```auto
{{ with .Resources.Match "test.jpg" }}
  {{ range . }}
    {{ .RelPermalink }}
...

```

---

<div class="post-metadata">

**Author:** ![SuperSonicSites](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/supersonicsites/32/11320_2.png) [@SuperSonicSites](https://discourse.gohugo.io/u/SuperSonicSites)\
**Post date:** [August 27, 2020, 11:40am UTC](https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853/3 "2020-08-27T11:40:24Z")

</div>

> [@SuperSonicSites](#):
>
> `{{end}}`

Thanks, now I don’t have an error but still nothing shows up. Why would that be?

---

<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:** [August 27, 2020, 11:43am UTC](https://discourse.gohugo.io/t/retrieving-page-resources-in-html-page-layout/27853/4 "2020-08-27T11:43:18Z")

</div>

I don’t know. Is it actually finding a match? It would be easier to help you if you had your code somewhere we can have a look at.
