Combing conditional (section) with limiting range to exactly three entries from two different sections?

I’d like to sort all site pages by most recent publish date and and only grab the first 3. I can do this via the following: {{ first 3 range .Site.Pages.ByPublishDate.Reverse}}

I also only want the article if the section is equal to “tutorials” or “articles,” which I can do with the following {{if or (eq .Section "articles") (eq .Section "tutorials")}}.

What I’m trying to accomplish is combining these two conditions. So I want to grab the three most recently published articles and tutorials (two different sections) so that I can display them in a single list on the homepage.

I had a similar “double conditional” requirement once, when building an ‘Archive’ section which had to show only articles of type ‘post’ while also also exlcuding the newest ten articles [which were on a separate ‘News’ page.

This is what I came up with*. You might be able to adapt it for your needs:

{{ $paginator := .Paginate (after 10 (where .Data.Pages "Type" "post")) }}

[*The phrase “came up with” shouldn’t be taken to imply mastery of the template syntax. It means I just kept hitting it with random pairs of brackets til the error messages stopped and it did what I wanted]

@stiobhart Thanks! I got it to work with the following:

{{ range first 3 (where .Site.Pages.ByPublishDate.Reverse "Type" "!=" "singletons")}}
{{ end }}

The reason for this modification is that I have two different types (ie, “Articles” and “Tutorials”) that I wanted to write to the page, and “singletons” is reserved for one-offs like /about, /contact, etc.