Sanity.io is a great way to have fully structured content quickly available via APIs. But content often needs to be rendered. Having your content on an API means you get to choose your favourite technologies to do this. It also however means you get to wire it together with your content APIs.
This is work. And when you're new to it, things can break. In strange ways. We've been talking to people for the past 16 months on this learning curve and thought we would do our bit to make things slightly easier.
Choose an example project, sign in to GitHub and Netlify, and hit Create project. After a few minutes, you have a new website that scales globally, a new content backend on Sanity.io, and all the code in your GitHub account. We made sure you could do this even from your phone.
We sat down and looked at the many questions raised in the community by people learning how to use Sanity and tried to make our examples answer quite a few of them: People want to learn more about how to best structure content for typical website projects. When you’re free of the constraints of structuring everything as “post” and “pages”, how do you go about it? How do you use Sanity as a page builder? How do you render rich text in Vue? What are best practices for data modelling? How to you mix data and rich text? And lots of others.
Right now we have examples for React/Gatsby, React/Next.js and Vue/Nuxt.js. All of them host code on GitHub and deploy with Netlify. The examples are pretty minimal to let you transmogrify them according to whimsy or need. There will be more!
We came up with four starter projects that are also great examples of why structured content is what you want.
Many people have asked us how one goes about using Sanity as a page builder. We came up with a content model that shows the advantages of structured content, also for traditional web pages. Managing content in Sanity lets you reuse the same content across websites. It lets you choose freely among frontend frameworks. And it contains patterns for how to go about building URLs and navigation. Of course, it gives you control over the metadata you need for Search Engine Optimization (SEO).
You should really consider having your blog on your own domain. That doesn’t mean that you have to become a sysadmin and run your own server. With the Gatsby.js + Netlify + Sanity.io combo you can concentrate on shaping your blog’s look and feel while making sure all your content is typed and structured. With Portable Text you can use real React components for all your rich text content, no more of that
Designers, agencies, freelancers, and companies need an easy way to show off their work, products, and services. With the Portfolio template, you don’t have to fiddle around with generic posts and pages. When documenting your work as structured content, you’re also creating an archive that can be repurposed later.
If you plan on doing a conference, or any event that entails speakers and talks, you can use the event listing template. It's a great example of a more advanced content model that lets you reuse content across presentation. You can extend it to a multiday, multitrack conference management system, and we plan to show you in upcoming tutorials.
APIs are an essential part of the JAMstack. It’s how you get the content for it. Of course, that’s where sanity.io comes in. We make sure you have the most flexible and best APIs for getting your content not only where it’s needed, but also how.
Now we offer both general and specific APIs for dealing with structured content. With the GraphQL API you get an API tied to you content schemas and that goes great together with all the modern tooling. With GROQ you have a powerful way of querying all your documents and project the results however you want it. It really doesn’t hold you back.
Oh, and just because these examples are all statically built it doesn't mean that future templates wil not feature serverless architectures, lambdas and fully dynamic shenanigans.
npm install -g @sanity/cli && sanity init