👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Creating an array of references for a product category in Sanity.io

2 replies
Last updated: May 13, 2020
Hey all, I’m trying to create an array of references in a product category document that populates with products that have their category defined. So, if I have a type of window with a category of “vinyl window”, I’d like that to show up in the array of refs in my “vinyl window” category. I found the validation section in the docs, but I’m not sure how to implement the idea
May 12, 2020, 8:53 PM
So, you're kind of trying to show incoming references for a document. E.g. "all documents referencing this document", right?
There's no out of the box way of doing that, but one way would be to create a new document tab and query for the documents in that tab and list them out yourself... would that work for you?


https://www.sanity.io/docs/structure-builder-typical-use-cases#tabs-with-content-previews-a8e5cc70dbc0
May 13, 2020, 7:37 AM
So, you're kind of trying to show incoming references for a document. E.g. "all documents referencing this document", right?
There's no out of the box way of doing that, but one way would be to create a new document tab and query for the documents in that tab and list them out yourself... would that work for you?


https://www.sanity.io/docs/structure-builder-typical-use-cases#tabs-with-content-previews-a8e5cc70dbc0
May 13, 2020, 7:37 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?