🎤 Builder Talk: The Story Behind Lady Gaga’s Digital Experience – Register now

Array of References as Field of an Object - How to Preview the Content Inside the Reference

2 replies
Last updated: Aug 14, 2020
Hi guys, I have a question, I have an array of references as field of an object, and I want to preview the content inside the reference, is it possible? Beacause with the prepare method in the preview I can only see the _key, _ref and the _type fields, thanks in advance.
Aug 14, 2020, 8:53 AM
Yes you should be able to do that. Have you had a look at this example? https://www.sanity.io/docs/previews-list-views#preview-using-fields-from-referenced-documents-dcbbdb0ec3aa
Aug 14, 2020, 9:04 AM
Thank you very much!
Aug 14, 2020, 9:10 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?

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
How to turn PortableText into plain text in Javascript?Dec 7, 2020
Rendering nested block contentJan 18, 2021
Custom Document Views - Is it Even Possible to Use the Structure Builder?Apr 21, 2022
GraphQL query resolving references on a _raw field in GatsbyMay 17, 2022
Error: unable to resolve image URL from source (undefined)Sep 11, 2022
Extracting referenced images from an object array in Sanity.ioMay 17, 2020
How to preview content inside a reference array in Sanity.ioAug 14, 2020
Hi, I need help with Iframe preview, I have a `route` schema with unique `slug` (`/lb/123`) and also I have `page` schema...Dec 21, 2020
Hi! How to add a doc via sanity client that has a *weak* reference? If I do this, it throws an error `key "weak" not allowed...Feb 2, 2021
How come images are returning with just a _ref in their assets?Feb 3, 2021

Related contributions

Turbo Start Sanity
- Template

The battle-tested Sanity template that powers Roboto Studio's websites

Go to Turbo Start Sanity

Schema UI - Next.js Sanity Starter
- Template

A Next.js starter template with Next.js 15, Tailwind CSS, shadcn/ui, and Sanity CMS with Live Editing. Get production-ready React components with matching Sanity schemas and queries. Build dynamic pages faster while keeping full control over customization.

Serge Ovcharenko
Go to Schema UI - Next.js Sanity Starter

The Swaddle
- Made with Sanity

A new brand identity to represent a more mature company, to signify The Swaddle’s evolution from publisher to production house, combined with an easier to navigate platform that can surface multiple content types - drawing readers through The Swaddle’s content offering.

Nightjar
Go to The Swaddle