Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

the Problem is when I add the Objects "location" and "exif" to the PortableText, than they will not be applied. I don't get the "Metadata" with the image.

7 replies
Last updated: Nov 2, 2020

Hello,I have a maybe small question.

I have added metadata to images like here. It works (
https://www.sanity.io/help/asset-metadata-field-invalid )But the Problem is when I add the Objects "location" and "exif" to the PortableText, than they will not be applied.
I dont get the "Metadata" with the image.

I'm using the standard Gridsome Sanity Blog Starter Template

{

type: 'mainImage',

options: {hotspot: true, metadata: ['location', 'palette', 'exif']  },


}

Nov 2, 2020, 1:17 PM

This would only be applied for new uploaded images, I think.
Have you tried uploading a new one and see if that gets the metadata?

Nov 2, 2020, 1:24 PM

This would only be applied for new uploaded images, I think.
Have you tried uploading a new one and see if that gets the metadata?

Nov 2, 2020, 1:24 PM

Thank you. I tried it. But no luck. The normal "mainImage" gives me metadata. The image in the Content Block not. I searched all Docs and this channel.

Nov 2, 2020, 1:31 PM

Right, so you will have to resolve the reference to get the data from the asset document..You have to use a raw field and

resolveReferences

https://github.com/sanity-io/gridsome-source-sanity#raw-fields

Nov 2, 2020, 1:40 PM

💯 Thank you! This was the missing part. Thank you for your time

Nov 2, 2020, 1:46 PM

Great!

Nov 2, 2020, 1:47 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.