I use this snippet on my blog overview, and that works fine:
{{ range ( where .Data.Pages.ByDate.Reverse "Section" "articles" ) }}
<li class="blog-tile">
{{ partial "blog-tile.html" . }}
</li>
{{ end }}
Now, I want to re-use the same snippet to promote blog posts to the homepage that have the tag ‘home’, but at the same time limit the list to 3 items being displayed at once.
I came up with this, but of course that doesn’t work, because it first filters down the list to 3 items and then checks whether the item has a tag of ‘home’:
{{ range first 3 ( where .Data.Pages.ByDate.Reverse "Section" "articles" ) }}
{{ if ( in .Params.tags "home" ) }}
<li class="blog-tile">
{{ partial "blog-tile.html" . .Section }}
</li> <!-- /.blog-title -->
{{ end }}
{{ end }}
Now I can’t figure out how to get my ‘range’ right so it only lists pages in the section ‘articles’ and at the same time have the tag ‘home’ applied to them
Thanks for your help!