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.
All content models
- EventSomething on at a date and time: a talk, a tasting, a class, a gig.title · date · start · where · line · image3 extensions: programme, recurring, tickets
- QuestionA question people ask and its answer.question · answer · order3 extensions: about, featured, group
- JobA vacancy: what the job is, where, on what terms, and where to apply.title · location · type · summary · posted · href4 extensions: employer, pay, shift, team
- LocationA place people go to: an office, a branch, a studio, a venue.name · line · address · city · postcode · photo3 extensions: contact, hours, map
- PersonSomeone on the site: an expert, a team member, a consultant, a reporter.name · role · line · photo · order3 extensions: byline, contact, expertise
- PlanA price someone can choose: a subscription tier, a membership, a package.name · price · period · line · features · action3 extensions: featured, offer, yearly
- PostAn article with its own page: a journal post, a guide, a news item, an insight.title · summary · date · cover3 extensions: byline, topics, updated
- FigureA number with what it means: 1931 · practising in York since.value · label · note · order2 extensions: source, trend
- StepOne step of a process: how switching works, what happens after you call.title · text · order2 extensions: span, when
- TestimonialWhat a customer, client or guest said, and who said it.quote · name · role · photo3 extensions: about, stars, visit
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.