Extracting referenced images from an object array in Sanity.io

3 replies
Last updated: May 17, 2020
Hey, I have a reference array to an object with bits of information (called socials), mainly text, and then inside socials I have another reference to an image document. On the front end :`*[_type == "header"]{logo, invertedLogo, menu, socials}` any tips on how would I go about extract that referenced image from socials to the imgBuilder and extracting the rest of the information from socials at the same time?
May 17, 2020, 5:53 PM
socials{image->asset._ref} or something like it πŸ™‚
May 17, 2020, 6:06 PM
Thank you, doing socials[]{...otherinfo, image[]->{image}} worked
May 17, 2020, 6:24 PM
it feels like I could do it in less steps but at least it works πŸ™‚
May 17, 2020, 6:26 PM

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?