Im trying to create a slice that display a filter grid, in which my custom type (book) need to be filtered by Author (Custom Type) and by Category (Custom type).
I set up my books so they can have a relationship with author and category.
so its set up as follows: "A book can have one or multiple authors and one or multiple categories".
Since im developing everything inside a slice (in order to be accessible throughout the site), im using
@prismic/react usePrismicDocumentsByType(documentType, params).
Welcome to the Prism ic community, and thanks for reaching out to us.
I believe what you want to achieve we have already discussed in the following threads:
Thanks for posting this question! Yes, it is possible to query by relationship, both ways.
I understand that in this example you have:
posts, which link to products
Querying all of the products for each post is relatively straightforward. When you query a post, you will get all of the product links, which include the metadata about each product. If you use
fetchLinks, GraphQuery, or GraphQL, you can fetch the products. (Let me know if you'd like more info about how to do…
Here are some documents in React.js and technical reference:
Pull in data from another document
Rest API technical reference.
GraphQuery API option.
Let me know if you have any further questions.