# Error on passing variable to partial: can't evaluate field in type \*hugolib.pageState

**URL:** <https://discourse.gohugo.io/t/error-on-passing-variable-to-partial-cant-evaluate-field-in-type-hugolib-pagestate/23038>\
**Category:** support\
**Created:** [January 25, 2020, 9:26pm UTC](https://discourse.gohugo.io/t/error-on-passing-variable-to-partial-cant-evaluate-field-in-type-hugolib-pagestate/23038 "2020-01-25T21:26:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [January 25, 2020, 9:26pm UTC](https://discourse.gohugo.io/t/error-on-passing-variable-to-partial-cant-evaluate-field-in-type-hugolib-pagestate/23038/1 "2020-01-25T21:26:02Z")

</div>

I’ve looked through the other questions on here about passing a variable to a partial, but unfortunately they don’t seem to solve my issue.

In layouts/products/single.html, I have the following:

```
  {{$desc := slice}}
  {{range (where (where site.RegularPages "Section" "companies") ".Title" "eq" .Params.company)}}
    {{$desc = .Description}}
  {{end}}
  
  {{partial "products/description.html" (dict "context" . "desc" $desc)}}

```

In partials/products/description:

`{{.desc}}`

This results in the error: `can't evaluate field desc in type *hugolib.pageState`.

I don’t understand the error. Can someone please explain what I’m doing wrong?

I’m using v0.61.

---

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [January 25, 2020, 11:14pm UTC](https://discourse.gohugo.io/t/error-on-passing-variable-to-partial-cant-evaluate-field-in-type-hugolib-pagestate/23038/3 "2020-01-25T23:14:47Z")

</div>

My code is correct, but I accidentally made a typo in my question. I’ve updated my post.

---

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [January 25, 2020, 11:26pm UTC](https://discourse.gohugo.io/t/error-on-passing-variable-to-partial-cant-evaluate-field-in-type-hugolib-pagestate/23038/5 "2020-01-25T23:26:40Z")

</div>

> [@b\_rad](#):
>
> {{range (where (where site.RegularPages “Section” “companies”) “.Title” “eq” .Params.company)}} {{.Description}} {{end}}

Just managed to figure out what the issue is, I think.

I’m calling the same partial multiple times in single.html.

I’m doing so like in my post:

```auto
  {{partial "products/description.html" (dict "context" . "desc" $desc)}}

```

But also later on without passing the variable, like so:

` {{partial "products/description.html" .}}`

And that’s what’s been causing the issue. An error on my part. Appreciate your help. Thanks.
