# Filter using array variable

**URL:** <https://discourse.gohugo.io/t/filter-using-array-variable/3026>\
**Category:** support\
**Created:** [March 31, 2016, 11:57am UTC](https://discourse.gohugo.io/t/filter-using-array-variable/3026 "2016-03-31T11:57:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrismcardle](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@chrismcardle](https://discourse.gohugo.io/u/chrismcardle)\
**Post date:** [March 31, 2016, 11:57am UTC](https://discourse.gohugo.io/t/filter-using-array-variable/3026/1 "2016-03-31T11:57:44Z")

</div>

Hi All,

I have a blog section in which the articles md files have categories assigned to them.

I was hoping that there would be a way to filter by using the last segment of the url but discovered that the docs only reference hard coded options. I went over this other posts method [http://npf.io/2014/08/making-it-a-series/](http://npf.io/2014/08/making-it-a-series/) but had equally no luck with it the call.

My categories are listed in an array as follows in the article md file  
categories = [“Support”, “Events”]

When I visit /blog/category/events/ I am looking to list out the information of all articles that have events in the categories array. The method I am using is below but I can’t seem to get it working, I have varied the way the call is made but still no joy.

{{ range (where .Site.Pages “.Params.categories” “in” “Events”) }}  
{{ .Title }}  
{{ end }}

The docs related to this function only reference a single variable and an reference to arrays just suggest “in” but I am stumped on this one.

> **[Functions Quick Reference](https://gohugo.io/functions/)**
>
> Comprehensive list of Hugo templating functions, including basic and advanced usage examples.

Cheers  
C

---

<div class="post-metadata">

**Author:** ![moorereason](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/moorereason/32/592_2.png) [@moorereason](https://discourse.gohugo.io/u/moorereason)\
**Post date:** [April 1, 2016, 1:45pm UTC](https://discourse.gohugo.io/t/filter-using-array-variable/3026/2 "2016-04-01T13:45:08Z")

</div>

For now you’ll need to put an `if` statement inside the `range`.

```auto
{{ range .Site.Pages }}
  {{ if in "Events" .Params.categories }}
    {{ .Title }}
  {{ end }}
{{ end }}

```

What you really need is this feature:

> <https://github.com/gohugoio/hugo/issues/2029>
