IF AND statement


Hi all, I’m a total newbie to Hugo. I’m trying to display some blog posts on the home page that match 2 criteria:

  1. They are of the blog content type
  2. They have a front matter parameter of “homepage” set to “true”

Here’s what I have so far:

{{ range first 3 (where .Data.Pages "Type" "blog") }}

How can I add an additional AND clause something like:

(where "Params.homepage" "eq" "true")



Does this help:



Typed this from my phone so no guarantee that it’ll work:

{{ $pages := where .Data.Pages "Type" "blog" }}
{{ $pages := where $pages "Params.homepage" "true" }}
{{ range first 3 $pages }}
1 Like


Also see https://gohugo.io/functions/intersect#and-filter-in-where-query

1 Like