# Where function Key when Key is frontmatter array

**URL:** https://discourse.gohugo.io/t/where-function-key-when-key-is-frontmatter-array/37495
**Category:** support
**Created:** [March 4, 2022, 7:59pm UTC](https://discourse.gohugo.io/t/where-function-key-when-key-is-frontmatter-array/37495 "2022-03-04T19:59:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Roger](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/roger/32/14113_2.png) [@Roger](https://discourse.gohugo.io/u/Roger)
#### Post date: [March 4, 2022, 7:59pm UTC](https://discourse.gohugo.io/t/where-function-key-when-key-is-frontmatter-array/37495/1 "2022-03-04T19:59:01Z")

</div>

Please see below example:

Front Matter:

```auto
authors: 
- Goeth Smalinsky
- Jordan Nevelin

```

In a partial:

`{{ $authorsPages := where .Site.RegularPages "Params.authors" "Geoth Smalinksky" }}`

The above returns false.

I believe correctly so, as “Params.authors” doesn’t equal a string, it’s an array of values, so, how then would I test this correctly?

I’ve tried various solutions, and am now simply ranging through $authorsPages and testing the Params with an if statement.

A la:

```auto
{{ $authorsPages := where .Site.RegularPages "Params.authors" "!=" nil }}
{{ range $authorsPages }}
  {{ if eq (index .Params.authors 0) "Jordan Nevelin" }}
     // Do stuff
  {{ end }}
{{ end }}

```

Which works fine, but it seems this could be much cleaner if I could write a better where statement.

Thank you for the assistance.

---

<div class="post-metadata">

### Author: ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)
#### Post date: [March 5, 2022, 1:03am UTC](https://discourse.gohugo.io/t/where-function-key-when-key-is-frontmatter-array/37495/2 "2022-03-05T01:03:14Z")

</div>

In a similiar scenario I use this:

Front matter:

```auto
tags:
  - Hugo
  - Fritz
  - Lara

```

My `where` code to get all pages with tag `Hugo`:

```auto
{{ $myPages := where site.Pages "Params.tags" "intersect" (slice "Hugo") }}

```

(Should also work with `.Site.RegularPages`, I think.)

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [March 7, 2022, 1:03am UTC](https://discourse.gohugo.io/t/where-function-key-when-key-is-frontmatter-array/37495/3 "2022-03-07T01:03:38Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
