Filter a list of page to only included with a specific set of tags

I’m new to templating, and I’m trying to wrap my head around it. I must admit that the information on https://gohugo.io/templates/taxonomy-templates/ is for me to grasp, yet. I think I need a more basic understanding of Go templating first, because many of the concepts I don’t really get (yet).

I understand how functions work, and I’m using things like this:

     {{ range where .Data.Pages.ByDate "Section" "articles" }}
        <li class="blog-tile">
           {{ partial "blog-tile.html" . .Section }}
        </li> <!-- /.blog-title -->
     {{ end }}

But now I want to filter this set of data to only include posts that match two specific tags (let’s say ‘a’ and ‘b’). I don’t really know where to start: do I have to include a new {{ where }} inside of {{ range }}?

My real question is perhaps: I don’t want to copy paste stuff I don’t fully understand. What’s a good primer / step-by-step tutorial I can read before I undertand what https://gohugo.io/templates/taxonomy-templates/ is all about? :slight_smile: Thanks!

Thanks!

I figured out I can use a nested ìn function to filter down the Pages results down to all pages that include a tag of ‘home’. Is this a recommended approach?

 {{ range where .Data.Pages.ByDate "Section" "articles }}
    {{ if in .Params.tags "home" }}
       <li class="blog-tile">
          {{ partial "blog-tile.html" . .Section }}
       </li> <!-- /.blog-title -->
    {{ end }}
 {{ end }}