Skip to content

Content models for Sanity and Astro

The content types most sites need, each defined once: a small core every site uses, plus extensions for one kind of site. Pick the extensions, then take the code as a Sanity schema with its GROQ query or as an Astro content collection. The data has the same shape in both.

Free and MIT, with no account. 10 models, 80 combinations, each tested in a new Sanity Studio and a new Astro project.

How the models work

A core and extensions. The core holds what every site draws (a testimonial is a quote, a name, a role and a photo). An extension only adds fields, such as star ratings or the visit a review was about. It never renames or removes a core field.

No settings. A score out of ten is not an option on the star rating: it would be its own extension. What you copy is plain code with nothing to configure.

The same data in Sanity and Astro. The Astro entry id is the Sanity slug, a reference is { collection, id } in both, and an image is always { src, alt, width, height }. A component that takes a testimonial can't tell which one fed it.

Copied, not installed. There is no package to keep up to date. The files land in your project and are yours to change.