@sanity/presets v1.0.0: Introducing @sanity/presets: ready-made schema types for common content patterns

Skip the boilerplate

@sanity/presets ships six define<Type> functions for the most common content patterns. Instead of modelling pages, links, images, and metadata from scratch, call a preset and get a working schema type with sensible defaults.

Included presets

definePage — document type for page building with content blocks, slug, and SEO metadata

defineLink — internal and external links with conditional fields

defineCta — call-to-action with an inline link and importance level

defineSeo — search engine metadata (title, description, Open Graph image)

defineImage — image with optional alt text, caption, and hotspot

defineRichText — Portable Text with link annotations, image blocks, and CTA inline objects

Getting started

Install the package, create the registry once, and use the define<Type> functions across your schema files:

import {createPresetsRegistry} from '@sanity/presets'

export const {definePage, defineLink, defineCta, defineImage, defineRichText} =
createPresetsRegistry({
link: {
// Document types an internal link can point to.
to: ['page'],
},
})

Experimental

This is a v1.0.0 release and the package is experimental — APIs may change in future versions. Presets are designed to be extended or replaced with hand-modelled types as your schema evolves. Read the full README on npm for usage details and patterns.