Sanity with Astro
This is the arrangement Sanity was designed for: one content model, queried by whatever needs it. Astro reads the documents at build and renders the pages, so there is no second CMS holding a copy and no sync to keep honest.
Sanity integrations like this usually take 1–2 weeks
How the handoff works.
- 01
Document
Published in Sanity
- 02
Webhook
The change leaves the Content Lake
- 03
Map
Portable Text and references resolved
Key handoff
- 04
Build
The page rendered from the document
- 05
Verify
The rendered page against the document
Why this is the key handoff
One model, rendered. Sanity keeps the model and the editing workflow; the build renders it. Nothing is copied, so there is no second version of a document to fall out of step with the first, which is the failure mode of every arrangement that puts a CMS behind a CMS.
Three things that commonly go wrong.
- 01
Portable Text is a decision, not a conversion
Marks, blocks, embeds and custom objects each need a component to render them, and the ones nobody maps render as nothing at all. I go through the types actually in use rather than the ones the schema allows, because those are rarely the same list.
- 02
Publishing in Sanity is not publishing on the site
A built site shows what it was built with, so an edit reaches the public page when a build runs. A webhook from Sanity can start one within seconds, but the relationship has to be deliberate and visible, because nobody wants the answer to "is it live yet" to be a guess.
- 03
Drafts and previews need their own path
The published build reads published documents, which is correct and is not what an editor wants while writing. Preview is a separate mode reading drafts with its own token, and it is worth building properly rather than leaving editors to publish in order to see.
What is included.
-
Sanity documents queried at build, or on demand where a page needs to be current
-
Portable Text rendered as components rather than flattened to HTML
-
References synced in the right order
-
Assets copied or re-hosted where needed
-
Deletes, unpublishes and draft states handled cleanly
Wire up something else?
-
Google Analytics with Astro
Analytics · typically 2–4 days
Learn more → -
Salesforce with Astro
CRM · typically 3–5 days
Learn more → -
HubSpot with Astro
CRM · typically 2–4 days
Learn more → -
Stripe with Astro
Payments · typically 1–2 weeks
Learn more → -
Segment with Astro
Data · typically 3–6 days
Learn more → -
Slack with Astro
Comms · typically 1–2 days
Learn more →
Reach out and see if we are a good fit.
Currently booking two to four weeks out.