How to fetch multiple documents within a single query?

342 Views Asked by At

I want to fetch multiple pages within a single query.

My code is causing errors

const pagesQuery = groq`{
    *[_type == 'homepage']{slug},
    *[_type == 'faq']{slug},
    *[_type == 'contact']{slug}
}`
1

There are 1 best solutions below

0
On BEST ANSWER

Something like this should work.

*[_type in ["homepage", "faq", "contact"]]{slug}