# Where(function) doesn't work with multiple params

**URL:** <https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512>\
**Category:** support\
**Created:** [July 15, 2022, 2:59pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512 "2022-07-15T14:59:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pleksa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pleksa/32/16904_2.png) [@Pleksa](https://discourse.gohugo.io/u/Pleksa)\
**Post date:** [July 15, 2022, 2:59pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512/1 "2022-07-15T14:59:31Z")

</div>

{{ range where .Pages “Params.tags” “Linux”}}  
This is the code i’ve been using and it only works if example.md tags look like:

Title: “Something”  
tags: “Linux”

As soon as i switch tags to:

Title: “Something”  
tags: =[“Linux”, “Windows”]

It doesn’t display the pages with Linux anymore since there’s another tag,it seemed to work when used in hugo docs,i’ve tried to change the code to .Pages “Params.tag” and change tags in the md to:

Title: “Something”  
tag: =[“Linux”, “Windows”]

So i im sure it’s not a problem with plurals.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [July 15, 2022, 3:09pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512/2 "2022-07-15T15:09:34Z")

</div>

There is a function called [`in`](https://gohugo.io/functions/in/#readout).

Understand this:

WHERE tags IS linux works on `tags: linux`. `tags=["linux", "somethingelse"]` is something else, along the lines of not a string but an array with strings 😉 So you have to check if your test-string is `in` the array of `tags`.

Something along the lines

`{{ range where .Pages "Params.tags" in "Linux" }}`

Not tested. But the first sample in the linked doc looks a lot like what you want.

---

<div class="post-metadata">

**Author:** ![Pleksa](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pleksa/32/16904_2.png) [@Pleksa](https://discourse.gohugo.io/u/Pleksa)\
**Post date:** [July 15, 2022, 4:08pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512/3 "2022-07-15T16:08:51Z")

</div>

i’ve tried {{ range where .Pages “Params.platforms” “in” “Windows”}}  
since in without “” displays an error.It doesn’t fix the issue even though i looked it up and it should,i’m not sure where i messed up

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 15, 2022, 4:12pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512/4 "2022-07-15T16:12:42Z")

</div>

Use `intersect` instead of `in`.

---

<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:** [July 17, 2022, 4:12pm UTC](https://discourse.gohugo.io/t/where-function-doesnt-work-with-multiple-params/39512/5 "2022-07-17T16:12:43Z")

</div>

Closed on July 17, 2022, 4:12pm UTC

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