I was trying to filter the “non-hidden” pages with the where
function but couldn’t get the desired result.
Here’s what I tried initially:
{{ $paginator := .Paginate (where .Pages "Params.hiddenPage" "not in" (slice true "true"))}}
I had four pages with the hiddenPage
param actually set and several others which didn’t have it.
Two of the pages had the param set to true
/false
as strings, the other two had true
/false
as booleans.
However, only the page with hiddenPage
set to string false
was returned in this case. And changing the where
condition operator to in
returned only the page with hiddenPage
set to string true
.
Is this the desired behavior? If yes, could you please point me to the right way to do this? If not, I would open a GH issue for the same.Thanks.
PS: I know the slice (with elements of different types) isn’t the issue because it works in this case:
{{ if .Params.hiddenPage | or .Params.noindex | in (slice "true" true) }}