Issue with alt_text in Sanity Studio resolved by uploading an image
13 replies
Last updated: Mar 25, 2021
S
Why doesn't the alt_text show up in studio?
Mar 25, 2021, 11:18 AM
S
how does your groq query look like?
Mar 25, 2021, 11:29 AM
S
Haven't got that far yet, I cant see it in the Sanity Studio:
Mar 25, 2021, 11:31 AM
S
but when i place the alt_text object outside of the image objects fields it works. Like this:
Mar 25, 2021, 11:32 AM
H
{ title: "Company Image", description: "Logotype for company", name: "image", type: "image", options: { accept: "image/png", }, fields: [ ], }, { name: "alt_text", type: "localeString", title: "Alternative Image text", description: "Important for SEO and accessibility", }, ],
Mar 25, 2021, 11:32 AM
S
Then it looks like it should except that its not nested:
Mar 25, 2021, 11:33 AM
S
Not really a big problem but was curious to why this is š
Mar 25, 2021, 11:36 AM
S
Hi User. What does the schema for your
localeStringlook like?
Mar 25, 2021, 1:49 PM
S
Hi! it looks like this:
Mar 25, 2021, 1:49 PM
S
import { supportedLanguages } from "./supportedLanguages"; export default { title: "LocaleString", name: "localeString", type: "object", fieldsets: [ { title: "Translations", name: "translations", options: { collapsible: false }, }, ], fields: supportedLanguages.map((lang) => ({ title: lang.title, name: lang.id, type: "string", fieldset: lang.isDefault ? null : "translations", })), };
Mar 25, 2021, 1:50 PM
S
And supportedLanguages looks like this
export const supportedLanguages = [ { id: "en", title: "English", isDefault: true, }, { id: "sv", title: "Swedish", }, { id: "no", title: "Norwegian", }, ];
Mar 25, 2021, 1:50 PM
S
Thanks for that. It seems to work for me when
alt_textis inside of the
fieldsarray on image. It requires that an image be selected before the Edit details button becomes available.
Mar 25, 2021, 1:58 PM
S
Aha, yes now I understand! Can't believe I didn't try to upload one lol, Thank you
user A
šMar 25, 2021, 2:01 PM
S
No problem! š
Mar 25, 2021, 2:01 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.