Skip to content

Instantly share code, notes, and snippets.

@cupofcrazy
Last active April 17, 2025 02:26
Show Gist options
  • Select an option

  • Save cupofcrazy/41cd1f7423c4f7f2634c806c8df79a2c to your computer and use it in GitHub Desktop.

Select an option

Save cupofcrazy/41cd1f7423c4f7f2634c806c8df79a2c to your computer and use it in GitHub Desktop.
Personal reusable Sanity schema types (WIP)
// A11Y Image with alt
const a11yImage = defineType({
name: 'a11yImage',
title: 'A11y Image',
type: 'object',
fields: [
defineField({
name: 'shot',
title: 'Shot',
type: 'image',
options: {
hotspot: true,
},
}),
defineField({
name: 'alt',
title: 'Alt',
type: 'string',
}),
],
});
// SEO Schema: title, description, Open Graph Image
export default defineType({
name: 'seo',
title: 'SEO',
type: 'object',
fields: [
defineField({
name: 'seoTitle',
title: 'Title',
type: 'string',
}),
defineField({
name: 'seoDescription',
title: 'Description',
type: 'text',
}),
defineField({
name: 'ogImage',
title: 'OG Image',
type: 'image',
options: {
hotspot: true,
},
}),
],
});
// Video schema feat. Mux Video
export default defineType({
name: "video",
title: "Video",
type: "object",
fields: [
defineField({
name: 'caption',
title: 'Caption',
type: 'string',
}),
defineField({
name: 'clip',
title: 'Clip',
type: 'mux.video',
}),
],
});
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment