[SOLVED] Filter Pages by array in Frontmatter

I know it’s possible to filter pages by frontmatter, but I cannot seem to get it to work with a parameter containing an array. E.g. think of the following front matter:

featured = ["local", "elsewhere"]

With all that I read up on the forums and documentation, I should be able to filter for a certain value like:

{{ range where .Site.Pages.ByWeight ".Params.featured" "in" (slice "local") }}

I tried all kinds of combinations with intersect or "in" "local" but I always get an empty result.
Am I missing something obvious? :smiley:

Something like this should work for your purposes

Thanks for the hint! I’ve stumbled upon this thread, but got lost after a few messages. :blush: This might indeed work for my use case, but it looks a bit cumbersome and I wonder whether I’m working against the Hugo core design. :grimacing:

I’m onto something. This might be solvable with a simple taxonomy. So far this looks like it could work:

featured = "featured"




{{ range .Site.Taxonomies.featured.local }}

I was about to say that since you’re flexible in your requirements you could filter content with taxonomies.

But you got it.