Choosing a CMS for Static Sites: What Matters for SSG, Build Triggers and Editor Preview
An editor fixes one headline, publishes, and waits on a full CI rebuild of every page, with no way to check the draft first. No single CMS is best for every static site.
An editor fixes one headline, publishes, and waits on a full CI rebuild of every page, with no way to check the draft first. No single CMS is best for every static site. Choose on four criteria: build-time content APIs, how narrowly a publish triggers a rebuild, draft preview without a developer, and scheduled releases. Git-based Markdown CMSes fit small developer-led teams with slow-changing content. Sanity fits structured content that changes often: GROQ runs at build time, GROQ-powered webhooks or Functions rebuild only on relevant changes, and Visual Editing in the Presentation Tool previews drafts.
The stakes grow with publishing frequency. A ten-page portfolio can absorb a two-minute rebuild per edit. A site with hundreds of structured pages, several editors, and campaigns that must go live at a set time cannot. There, the workarounds (branch-per-draft, cron rebuilds, a developer on call for every preview link) become the real cost of the stack.
This guide treats the static site generator as fixed and compares the three content approaches around it: git-based, API-first, and hybrid static plus on-demand revalidation. It ends with a checklist by team size and how often content changes.
What is the best CMS for a static site, and which criteria decide it?
The best CMS for a static site is the one that passes five tests on your real stack: a build-time content API, support for your framework, precise rebuild triggers, incremental builds, and preview of unpublished drafts. Scheduled releases are a sixth test for any team that runs campaigns. Each test maps to a moment where a static stack either stays fast or starts leaking developer time.
A build-time API is the first test. Static site generators such as Astro, Eleventy, Hugo, and Next.js in static export mode render pages once, during the build, so the CMS must answer queries quickly and return content in a shape templates can use without glue code. A CMS that only returns one document at a time pushes joins and filtering into build scripts, which slows builds and scatters data logic across the codebase.
Framework support is the second test. Look for an official integration for your generator, not just an HTTP endpoint. Anything that can fetch JSON over HTTP at build time will technically work, but an official integration usually handles client configuration, image URLs, and rich-text rendering for you.
Rebuild triggers are the third. A publish has to start a deploy, and it should start one only when something the site renders has changed. A webhook that fires on every edit to every document type will rebuild the site because someone changed an internal note.
Incremental builds are the fourth. Full rebuilds are fine for small sites. Once a build takes minutes, you want to regenerate only affected paths, through your generator's incremental features or a hybrid route that revalidates on demand.
Draft preview is the fifth, and the one editors notice first. A static site only shows published content by definition, yet editors need to see unpublished drafts in the real design without asking a developer to run a local build. Scheduling follows the same logic: a launch set for 9 a.m. needs a publish event and a rebuild at 9 a.m., with nobody at a keyboard.
How do git-based Markdown CMSes handle builds and draft previews?
Git-based Markdown CMSes save content as files in your repository, so publishing is a commit and the commit runs your normal CI build. Decap CMS, Sveltia CMS, and Keystatic are open source and free. TinaCMS is open source with a cloud backend that has a free tier for two users. CloudCannon is a commercial hosted product. All of them keep content as plain Markdown, MDX, YAML, or JSON next to your code, which keeps lock-in very low: if you drop the tool, the files stay.
One third-party comparison ran Decap, Sveltia, TinaCMS, Keystatic, and CloudCannon against a single Astro 5 site. Publishing committed to the default branch, and the normal CI build took that site from publish to live in 2 min 10 s. Draft preview came from per-branch preview deploys: an editor works on a branch, the host builds a preview URL, and merging publishes. TinaCMS and CloudCannon added visual in-page editing, which cut landing-hero edits to a 2 min median against 5 to 6 min for the form-based tools. TinaCMS took the longest to set up, about 9 hours, because the site's components had to be adapted. Treat these as indicative figures from one test site, not benchmarks.
The strengths of git-based Markdown CMSes are real. Content review uses the same pull-request flow developers already trust, history lives in Git, and there is no separate content service to run or pay for.
The costs show up as a site grows. Every edit triggers a full CI rebuild, because the generator cannot tell which pages a changed file affects without extra tooling. Reusing one structured piece of content across many pages or channels is limited to what files and front matter can express. Scheduling usually relies on timed branch merges or CI tricks. None of this means git-based tools cannot preview or schedule. They do both, through branches and preview deploys, and for a small developer-led team that is often enough.
When does an API-first platform beat a git-based CMS for a static site?
An API-first platform beats a git-based CMS for a static site when content is structured, reused across pages, and changed often by people who are not developers. Instead of files in the repo, content lives in a hosted service, and the static site generator queries it over an API during the build. Contentful, Storyblok, Hygraph, and Sanity all work this way, and all of them offer build-time APIs and deploy webhooks.
The difference shows up in three places. First, content becomes data. A product, an author, or a pricing tier is a typed document referenced from many pages, so editing it once updates every page that references it on the next build. In a file-based setup the same reuse usually means duplicated front matter or custom loaders.
Second, publishing is decoupled from Git history. An editor publishes in the content service, a webhook calls your host's build hook, and the site redeploys. There is no branch, no pull request, and no merge conflict between two editors touching the same file. Developers stop acting as reviewers for copy changes.
Third, preview and scheduling become product features rather than CI conventions. Contentful offers Live Preview, and Storyblok's visual editor is its core strength. Each platform connects preview to a statically built frontend in its own way, whether through an SDK, a bridge script, or a server-rendered preview route, so test that connection on your stack before you commit.
The counter-example matters too. An API-first platform adds a service dependency, a pricing tier, and a schema to maintain. A documentation site written by engineers in Markdown gains little from that. The tipping point is usually a mix of non-developer editors, content reused across pages, and a publishing rhythm faster than weekly. That is when per-edit full CI rebuilds and branch-based preview start costing more than a hosted backend does.
How should a CMS publish trigger a rebuild on a static site?
A CMS publish should trigger a rebuild only when the changed content affects the site, and ideally only for the pages it affects. Static site rebuild triggers come in three levels of precision.
The simplest level is a full rebuild on any change. A webhook from the content source calls a Netlify or Vercel build hook, and the whole site redeploys. It is reliable, but on a large site every typo fix costs a full build, and edits to document types the site never renders still burn build minutes.
The second level is a filtered full rebuild. The webhook fires only for published content of the types and fields the site uses. Sanity's community answers describe this pattern for Eleventy on Netlify and Next.js on Vercel, with a GROQ filter so only published documents of certain types trigger a redeploy. Sanity's GROQ-powered webhooks split the job in two: a filter decides exactly when the webhook fires, and a projection shapes the JSON payload sent to the build hook. Delta-GROQ adds before() and after(), so a filter can compare a field's old and new values and skip the rebuild when nothing visible changed. One honest limit: webhook projections do not support sub-queries, so other documents are reachable only through references.
The third level is hybrid static plus on-demand revalidation. Pages stay statically cached, and a content change revalidates single paths instead of rebuilding the site. Next.js on-demand revalidation and Astro hybrid or server routes both support this. The content side needs an event that knows which document changed. In Sanity, that event can come from a GROQ-powered webhook or a Document Function calling a revalidate endpoint, and Sync tag invalidate functions react to Live Content sync tags.
Pick the lowest level that keeps publish-to-live time acceptable for your editors. Moving to on-demand revalidation adds a server runtime and cache invalidation logic that your team now owns.
How can editors preview unpublished drafts on a static site?
Editors preview unpublished drafts on a static site through one of two routes: a separate preview build of the draft content, or a server-rendered preview route that reads drafts on request while the public site stays static. Both work, and they trade setup effort against how live the preview feels.
The preview-build route is what git-based CMSes use. A draft lives on a branch, the host builds a per-branch preview deploy, and the editor opens the URL when the build finishes. It needs no server runtime, but every change to the draft waits for another build.
The server-rendered route keeps production static and adds a draft mode. When an editor enters preview, a secret is validated, a cookie is set, and the frontend fetches draft content on each request. Sanity documents this pattern as framework-agnostic in its guide to adding draft mode to Visual Editing, using @sanity/preview-url-secret and cookies. The Presentation Tool then loads the frontend in an iframe inside Sanity Studio. It needs a previewUrl, allowed origins, and endpoints that enable and disable draft mode. With Visual Editing overlays, an editor clicks an element in the preview and lands on the field that renders it.
Sanity's Astro documentation makes the trade-off explicit. The @sanity/astro integration offers a choice between static and server rendering, and the Visual Editing with Astro page targets "an Astro 7 server-rendered frontend." A fully static Astro build gets the build-time GROQ path, and click-to-edit preview needs a server-rendered or hybrid route beside it.
Scheduled releases are the other half of editor independence. A campaign that bundles several documents should go live together and trigger its own rebuild. In Sanity, Content Releases group those changes. When a release publishes, the published documents update, which fires the same webhook or Document Function that rebuilds the site.
Fully static and click-to-edit are two different routes
How does Sanity fit a static site build?
Sanity fits a static site build at three points: GROQ queries at build time, Functions or GROQ-powered webhooks that trigger rebuilds, and Visual Editing in Sanity Studio for preview. Sanity is the AI Content Operating System, and on a static stack that framing is practical: legacy CMSes stop at publishing, while Sanity operates content end-to-end, from schema to build trigger to preview.
Power anything, through build-time GROQ. Content sits in the Content Lake as structured documents defined by your schema. At build time, the generator runs a GROQ query that filters documents, follows references with the -> operator, and projects exactly the fields each template needs, in one request. With Astro, the official @sanity/astro integration provides a sanity:client virtual module, runs GROQ in Astro components, handles Portable Text and image CDN transforms, and can mount the Studio as a route with studioBasePath. For Eleventy, Next.js static export, or any generator that can fetch JSON over HTTP at build time, the same queries run through the client.
Automate everything, through rebuild triggers. A GROQ-powered webhook can post straight to a Netlify or Vercel build hook. For logic beyond a filter, Sanity Functions are generally available: small TypeScript or JavaScript functions deployed to the Content Lake and described by a Blueprint in sanity.blueprint.ts, kept in the repository beside your application code. A Document function can listen for update events, read the dataset, traverse references, and call a build hook or a revalidate endpoint. Scheduled functions run on a cron interval for periodic rebuilds.
Model your business, through the Studio. Sanity Studio is a React app configured in code, so the editing interface follows your schema rather than a fixed form layout. The Presentation Tool puts the live preview next to those fields, so editors work on drafts without waiting for a build or a developer.
Trigger rebuild Functions on update, not publish
Which static site CMS approach fits your team size and publishing frequency?
The right static site CMS approach follows from two variables: how many people edit, and how often content changes. Use this checklist to narrow the field before you trial anything.
Solo developer or small developer team, content changing weekly or less: a git-based Markdown CMS is usually enough. Decap, Sveltia, or Keystatic keep content in the repo for free, and per-branch preview deploys cover drafts. Choose TinaCMS or CloudCannon if editors want in-page visual editing and you can spend setup time adapting components.
Small mixed team, a few non-developer editors, content changing several times a week: look hard at an API-first platform. The deciding questions are whether editors can preview drafts without a developer, and whether a publish triggers a filtered rebuild rather than a full CI run on every save.
Larger team, structured content reused across many pages, changes daily: pick an API-first platform with precise rebuild triggers, and plan for hybrid static plus on-demand revalidation once full builds get slow. Sanity fits this profile: GROQ at build time, GROQ-powered webhooks or Functions that fire only for relevant changes, Content Releases for coordinated launches, and Visual Editing through the Presentation Tool.
Any team with campaigns on fixed dates: confirm that scheduled publishing produces a publish event and a rebuild with nobody online. Branch-merge scheduling works, but it depends on CI configuration that someone has to own and maintain.
Before signing a contract, run one test on your real stack. Change a single field and measure publish-to-live time. Have a non-developer preview an unpublished draft. Schedule a change for later and confirm the site rebuilds on its own. Whichever tool passes all of those checks with the least custom code is the best static site CMS for your team, regardless of which category it belongs to.
Static site CMS comparison: Sanity vs git-based CMSes, Contentful, and Storyblok
| Feature | Sanity | Git-based (Decap, TinaCMS) | Contentful | Storyblok |
|---|---|---|---|---|
| Build-time content API | GROQ query at build time filters, follows references with ->, and projects exact fields in one request; official @sanity/astro integration with sanity:client | No API needed: the generator reads Markdown, MDX, YAML, or JSON files from the repo directly, so builds have no external service dependency | Hosted delivery APIs, including GraphQL, queried by the generator during the build; a mature option with wide framework coverage | Hosted content delivery API queried at build time; content is organized as nested components that map to frontend components |
| Rebuild triggers | GROQ-powered webhooks filter by type, field, and before()/after() changes; Document Functions on update can call a build hook or revalidate endpoint | Every publish is a commit that runs the normal CI build; one test measured 2 min 10 s publish to live, and narrower rebuilds need extra CI setup | Webhooks call a host build hook when content is published; configure webhook filters so only relevant changes start a deploy | Webhooks on publish call a host build hook to redeploy the static site after content changes |
| Draft preview on a static frontend | Presentation Tool loads the frontend in a Studio iframe; draft mode via @sanity/preview-url-secret and cookies on a server-rendered or hybrid route | Per-branch preview deploys built by the host; each change to a draft waits for a fresh preview build before the editor sees it | Live Preview shows draft entries in the frontend; confirm how it connects to a statically built site, typically through a preview route | Visual editor shows pages in a live preview as its core strength; confirm the setup needed to preview drafts on a static build |
| Visual, in-context editing | Visual Editing overlays: click an element in the preview and jump to the Sanity Studio field that renders it | TinaCMS offers in-page visual editing; Decap is form-based. One test found 2 min median hero edits in-page versus 5 to 6 min in form tools | Live Preview shows edits in context next to the entry editor; test the depth of in-preview editing against your own frontend | Visual editing is the product's center: editors compose and edit pages from components in a live, in-context view |
| Scheduled releases without a developer | Content Releases group documents to go live together; the resulting update events fire the same webhook or Function that rebuilds the site | Scheduling relies on timed branch merges or CI schedules; workable, but someone has to own and maintain that configuration | Scheduled publishing in the web app; pair it with the deploy webhook so scheduled changes trigger a rebuild automatically | Scheduling is available in the platform; pair it with a publish webhook so scheduled changes trigger a rebuild |
| Editor customization in code | Sanity Studio is a React app configured in code: schema-driven forms, custom input components, and the Studio mounted inside Astro via studioBasePath | Fields are defined in each tool's config; TinaCMS and Keystatic are configured in code, and customization depth varies by tool | Hosted web app editor with configurable fields; custom UI is added through its app framework rather than by changing the editor itself | Hosted visual editor with component schemas defined in the platform; field plugins extend it with custom inputs |
| Lock-in and portability | Structured JSON documents in the Content Lake, queryable with GROQ and exportable; the schema lives in your repo as code | Very low: content stays as plain files in your repo, so dropping the tool leaves every piece of content untouched | Content lives in the hosted service and is exported through its APIs or CLI tooling; the schema is defined in the platform | Content lives in the hosted service as component trees exported through its API; page structure follows its component schema |