Filter Tags created as a "Multiple links" field

Making a blog site with nuxt and datocms. I want articles to have tags and want the ability to get all articles with a specific tag.

I set my schema so that tags are a separate model. Doing this because I have a second query to get all the tags so I can build a links to pages of articles with those tags.

Here is my setup


Articles have a Multiple Links field linked to the tags.

This allows me to have a nice interface to add tags to articles in the content editor.

Now, what I’m trying to do is have a query that only returns articles with a specific tag. Based on this post I was hoping to do that with a pattern. But I get this error:

I can get it to work with a tag id with the below query, but would really like to use the tag name instead. I don’t really want to see the tag id in the url.

Is there a different/better approach that I’m missing?

Hi @awdriggs,

I think it might be easier to use inverse relationships for this. If you enable that on the Tag model, like this:

Then you can query for its inverse (all articles that link to that tag):

query MyQuery {
  tag(filter: {name: {eq: "game"}}) {
    _allReferencingArticles {

Does that help?

@roger That work beautifully! Thanks!

1 Like