# Iterate over a list of Params in layout

**URL:** https://discourse.gohugo.io/t/iterate-over-a-list-of-params-in-layout/38835
**Category:** support
**Created:** [May 28, 2022, 7:05am UTC](https://discourse.gohugo.io/t/iterate-over-a-list-of-params-in-layout/38835 "2022-05-28T07:05:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![martinschneider](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/martinschneider/32/17006_2.png) [@martinschneider](https://discourse.gohugo.io/u/martinschneider)
#### Post date: [May 28, 2022, 7:05am UTC](https://discourse.gohugo.io/t/iterate-over-a-list-of-params-in-layout/38835/1 "2022-05-28T07:05:29Z")

</div>

I’m displaying the categories of my blog in a menu. Now, I’d like to filter them.

I define a parameter in my config:

```
menuCategories = ["Category 1", "Category 2"]

```

And then use it as a filter in my layout:

```
{{ $whitelist := .Site.Params.menuCategories }}
{{ range .Site.Taxonomies.categories }}
{{ if (in .Page.Title $whitelist) }}
  <li class="tag"><a title="{{ .Page.Title }}" href="{{ .Page.Permalink }}">{{ .Page.Title }}</a></li>
{{ end }}
{{ end }}

```

However, the `if` statement never evaluates to true.  
Is `whitelist` not a `list` here that I can use `in` on?

---

<div class="post-metadata">

### Author: ![martinschneider](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/martinschneider/32/17006_2.png) [@martinschneider](https://discourse.gohugo.io/u/martinschneider)
#### Post date: [May 28, 2022, 1:35pm UTC](https://discourse.gohugo.io/t/iterate-over-a-list-of-params-in-layout/38835/2 "2022-05-28T13:35:34Z")

</div>

> [@martinschneider](#):
>
> ```auto
> {{ $whitelist := .Site.Params.menuCategories }}
> {{ range .Site.Taxonomies.categories }}
> {{ if (in .Page.Title $whitelist) }}
> <li class="tag"><a title="{{ .Page.Title }}" href="{{ .Page.Permalink }}">{{ .Page.Title }}</a></li>
> {{ end }}
> {{ end }}
> 
> ```

Turns out I’m just an idiot. I got the order of the arguments wrong.

```
{{ if (in $whitelist .Page.Title) }}

```

works fine.
