Filed under:
Here's how to filter posts by label names in Blogger template code for the Blog widget.
First, define a set of label names as a variable. For example, if you want to filter posts with labels exactly "blogging" and "tutorial", then it should looks like this:
<b:with var='labelNames' value='[ "blogging", "tutorial" ]'>
<!-- ... -->
</b:with>Next, create a filtered posts data using the following lambda expressions. This expressions evaluates to true if a post has both "blogging" and "tutorial" labels, and false if only one of each is present.
<b:with var='labelNames' value='[ "blogging", "tutorial" ]'>
<b:with var='filteredPosts' value='data:posts where (post =>
post.labels count (label => label.name in labelNames) == labelNames.length
)'>
<!-- ... -->
</b:with>
</b:with>Finally, use the filteredPosts variable to display the filtered posts data.
More about Lambda Expressions:
https://www.blogger.com/rpc_relay.html https://www.blogger.com/comment/frame/8166404610182826392?po=3151852003872143376&hl=en&saa=85391&origin=https://vanillawebdev.blogspot.com&skin=contempo https://vanillawebdev.blogspot.com/2026/09/filtering-posts-in-blogger-blog-widget.html#comments true ["blogger","blogger-template-development"]