# Nil pointer evaluating resource.Resource.RelPermalink

**URL:** <https://discourse.gohugo.io/t/nil-pointer-evaluating-resource-resource-relpermalink/23591>\
**Category:** support\
**Created:** [February 21, 2020, 2:01pm UTC](https://discourse.gohugo.io/t/nil-pointer-evaluating-resource-resource-relpermalink/23591 "2020-02-21T14:01:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtgry](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@jtgry](https://discourse.gohugo.io/u/jtgry)\
**Post date:** [February 21, 2020, 2:01pm UTC](https://discourse.gohugo.io/t/nil-pointer-evaluating-resource-resource-relpermalink/23591/1 "2020-02-21T14:01:38Z")

</div>

Hello, I’m having issues with image resources when using a json data file and receiving the error below.

`<$image.RelPermalink>: nil pointer evaluating resource.Resource.RelPermalink`

I do not receive this error when using page params instead of json data.

Code:

```auto
{{ $roster := getJSON .Params.roster }}
{{ range $roster }}      
<div class="dropdown-container">
  <header class="clearfix">
    {{ with .Image }}
    {{ $image := resources.GetMatch . }}
      <img class="lazyload" data-object-fit="cover" src="{{ $image.RelPermalink }}" alt="{{ $.Name }}">
    {{ end }}    
      <h3>{{ .Name }}</h3>
      <figure class="expand">
        <svg alt="" class="svg-icon" viewBox="0 0 20 20">
          <path fill="none" d="M15.898,4.045c-0.271-0.272-0.713-0.272-0.986,0l-4.71,4.711L5.493,4.045c-0.272-0.272-0.714-0.272-0.986,0s-0.272,0.714,0,0.986l4.709,4.711l-4.71,4.711c-0.272,0.271-0.272,0.713,0,0.986c0.136,0.136,0.314,0.203,0.492,0.203c0.179,0,0.357-0.067,0.493-0.203l4.711-4.711l4.71,4.711c0.137,0.136,0.314,0.203,0.494,0.203c0.178,0,0.355-0.067,0.492-0.203c0.273-0.273,0.273-0.715,0-0.986l-4.711-4.711l4.711-4.711C16.172,4.759,16.172,4.317,15.898,4.045z"></path>
        </svg>
      </figure>
  </header>
  <article>
    <div class="article-inner">
      {{ with .Class }}
      <p>Class: {{ . }}</p>
      {{ end }}
      {{ with .Highschool }}
      <p>High School: {{ . }}</p>
      {{ end }}
      {{ with .Hometown }}
      <p>Hometown: {{ . }}</p>
      {{ end }}
      {{ with .Position }}
      <p>Position: {{ . }}</p>
      {{ end }}
    </div>
  </article>
</div>
{{ end }}

```

Sample Data:

```auto
[
  {
    "No.": "01",
    "Name": "Joe Smith",
    "Class": "So",
    "Highschool": "Pebble High School",
    "Hometown": "Austin, TX",
    "Position": "",
    "B/T": "",
    "Image": "/uploads/jsmith.jpg"
  }
]

```

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [February 21, 2020, 3:37pm UTC](https://discourse.gohugo.io/t/nil-pointer-evaluating-resource-resource-relpermalink/23591/2 "2020-02-21T15:37:54Z")

</div>

Hugo Resources are available only under two scenarios:

1. If under the `contentDir` files are organized in [Page Bundles](https://gohugo.io/content-management/organization/)
2. If the file one wants to fetch as a Hugo Resource resides under the [`assetDir`](https://gohugo.io/hugo-pipes/introduction/#asset-directory)

It appears that you are doing something different.

Also see the [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132) guidelines.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [February 28, 2020, 4:00pm UTC](https://discourse.gohugo.io/t/nil-pointer-evaluating-resource-resource-relpermalink/23591/3 "2020-02-28T16:00:04Z")

</div>

Closed on February 28, 2020, 4:00pm UTC

This topic was automatically closed after 16 hours. New replies are no longer allowed.
