Where OR function

I’m trying to use where with an OR - is this possible??


{{ range where .Data.Pages ".Params.moderated" "==" true OR ".Params.moderated" "==" nil }}

(i.e all pages where there is a params.moderated = true OR it isn’t set at all)

Obviously thats not working so how do I do this??


Maybe check out the union function. https://gohugo.io/functions/union#readout

See if this is similar to what you’re looking for: Trying to list sections and pages based on content and page params

Awesome. Thanks

For the record I did it like this:

    {{$a := where .Data.Pages ".Params.moderated" "==" true}}
{{$b := where .Data.Pages "Section" "post"}}
{{$c := $a | union $b }}
    {{ range $c }}