How to list top X posts with same tags?

I have a blog where each post has a set of tags. I want to display a list of similar posts - X posts that share at least one tag. What would be the best way to do it?

I iterate over all posts
{{ range where .Site.RegularPages “Section” “posts” }}

but how do I narrow it down further? I tried with nested ranges but it does not seem to be supported.

I tried several approaches for couple of hours but none of them worked.

1 Like

Oh wow, so easy! Thanks!