Ask Your Question
3

What is the method for applying a filter to a dynamic zone in Strapi using GraphQL?

asked 2023-02-13 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-03-18 10:00:00 +0000

huitzilopochtli gravatar image

To apply a filter to a dynamic zone in Strapi using GraphQL, you can use the where argument with the name of your dynamic zone as the field name.

For example, if you have a dynamic zone called sections in your Strapi schema, and you want to filter the results to only include sections where the type field is equal to "jumbotron", you could use the following GraphQL query:

query {
  articles {
    sections(where: {type: "jumbotron"}) {
      ... on ComponentJumbotron {
        title
        subtitle
        image {
          url
        }
      }
    }
  }
}

This query would return a list of articles, each with their corresponding sections field filtered to only include ComponentJumbotron components where the type field is "jumbotron".

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-13 11:00:00 +0000

Seen: 13 times

Last updated: Mar 18 '23