Skip to content

Instantly share code, notes, and snippets.

@3200pro
Created July 12, 2020 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3200pro/d14f176b2b4470e3ee46e0f65b08b3f7 to your computer and use it in GitHub Desktop.
Save 3200pro/d14f176b2b4470e3ee46e0f65b08b3f7 to your computer and use it in GitHub Desktop.
Sanity CMS Figure Schema
export default {
name: "figure",
title: "Image",
type: "image",
options: {
hotspot: true,
},
fields: [
{
title: "Caption",
name: "caption",
description: "Leave blank if you do not want a caption",
type: "string",
options: {
isHighlighted: true,
},
},
{
name: "alt",
type: "string",
title: "Alternative text",
validation: Rule =>
Rule.error("You have to fill out the alternative text.").required(),
description: "Important for SEO and accessiblity.",
options: {
isHighlighted: true,
},
},
{
title: 'Disable GatsbyImage',
name: 'disableGatsbyImage',
type: 'boolean',
},
],
preview: {
select: {
imageUrl: "asset.url",
title: "alt",
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment