There are GetMatch/Match functions that matches the name frontmatter of your resources. GetMatch gets the first one that matches, Match gets them all. Give them a name that starts with “gallery” and match on “gallery*”.
name
A related post:
The documentation of GetMatch/Match: