Before we even touch upon Sanity Schema, I want to do a brief rundown of Structured content because it's important when assessing what needs to be in/out of your schema.
Structured content is a method of organising and managing information in a standardised, consistent format. It improves content accessibility and discoverability, making it easier for users and developers to find and use the information they require. Sanity is a powerful platform for structured content.
Give me an example in real terms
An example is a blog post you've almost definitely come across. They all have different fields but let's address the ones that nearly always appear:
- Title
- Publish date
- Author
- Body of text
Structured content is all about organising the above into an easy-to-understand structure without forcing your content creators to spend 20 mins scanning through forms.
The grandma test
How do we make structured content in a simple, consistent way? We design it for our grandmas'.
Instead of thinking of our schema as a complex collection of data, we approach it as if it's a note we left on the fridge. Keep it casual, friendly and assume pitfalls when writing it.
E.g. don't make a title too short.
Here's an example of writing the above schema with Grandma in mind:
The more you think of writing up schema as if it's a note to Grandma, the better it will be. It'll be less confusing; it will take a little longer to write but guaranteed to save you time in the future.
We're probably going to be releasing more tips in the future so keep your eyes peeled for more advice on getting the most out of Sanity.