Preview & Draft Workflow Patterns
This section governs the editorial half of a headless integration: how unpublished content reaches the people who need to review it, and how published content reaches everyone else. The contract is that drafts are visible only to authenticated reviewers, render with exactly the production components, never enter a shared cache, and become public through one verified publish pipeline that updates every cache tier within seconds.
In a traditional CMS, preview is a built-in feature: the same server renders drafts for logged-in editors and published pages for readers. A headless architecture splits those responsibilities across systems that do not share sessions, caches or deployment pipelines. The CMS holds the drafts, the frontend renders them, a CDN sits in front of both, and a webhook connects the moment of publishing to the moment readers see the change. Every guide in this section addresses one of those boundaries: how to fork requests into draft and published paths, how to authenticate reviewers across origins, how to stream edits into a live preview, how to rebuild or revalidate on publish, how to keep previews accessible, and how to keep all of this working while a legacy CMS is being retired.
Core Concepts & Terminology
Six terms carry most of the reasoning in this section.
Draft state. The version of an entry that editors see but readers do not. Most edits happen to entries that are already live, so the common case is a draft layered over a published version, not a brand-new entry. Draft state management covers how the frontend keeps the two apart in every fetch and cache.
State signal. The single, server-validated fact that turns a request into a preview request: a framework draft-mode cookie, a signed session, or a token-gated route. Components never decide on their own whether to fetch drafts; they ask one helper that reads the signal.
Preview token. A short-lived, signed credential minted by the CMS when an editor clicks preview, exchanged once for a session and never stored in URLs afterwards. Token-based preview authentication covers minting, scoping, share links and rotation.
Live editing. Streaming field changes from the CMS into the preview as the editor types, often combined with click-to-edit overlays that map rendered elements back to fields. Live editing integration patterns compares the SDKs of the major platforms and the custom alternatives.
Publish pipeline. The chain from a publish event in the CMS to updated pages for readers: a signed webhook, verification, mapping to cache tags or routes, revalidation or a build, and CDN purges. Webhook-triggered rebuilds covers each link in that chain.
Preview parity. The requirement that preview renders with the same components, layouts, styles and accessibility behaviour as production. Without parity, editors approve content that breaks when it goes live, and accessibility compliance problems slip through review.
Architecture Decision Frame
Four forces shape every preview integration, and naming them keeps design discussions short.
Isolation strength. How strongly must drafts be separated from public traffic? A marketing blog can preview on the production domain with a draft-mode cookie. A listed company’s quarterly results need single sign-on, per-person audit trails and a separate preview host. The stronger the requirement, the more layers of isolation: tokens, sessions, separate hosts, uncached routes, and role checks.
Freshness of preview. Do editors need to see changes as they type, after each save, or only when they click preview? Live editing needs an update channel and an SDK or custom stream; save-and-refresh needs only an uncached route; click-to-preview needs only a token exchange. More freshness means more moving parts, so choose it where editors build pages visually rather than everywhere.
Rendering mode. Static builds cannot render drafts without a server, incremental regeneration needs draft mode to bypass its cache, and server rendering handles drafts naturally but must still keep them out of the CDN. The data fetching and caching section describes each mode’s caches, which are exactly the caches preview must avoid.
Organizational shape. How many editors, how many sites, how many environments, and how much external review? A single team with one site can configure webhooks by hand; an agency with twenty sites on one CMS needs routers, per-environment secrets and share links for clients.
Preview Delivery: Routing, Authentication and Caching
A preview request passes through three decisions, in a fixed order. First, routing: which host and route serve it. Many teams use the production domain with a draft-mode cookie, because it shows exactly what readers will see; teams with stricter isolation use a separate preview host that the CDN never caches and search engines never index. Second, authentication: the request must prove it came from an authorized reviewer, which in practice means a token minted by the CMS and exchanged for a short, httpOnly session. Third, fetching: every data request in the render must use the preview API and token, bypass the framework’s data cache, and return uncached responses.
The failure modes are symmetrical. If any fetch ignores the state signal, editors see published content in preview and conclude that their changes were lost. If any response in the preview path is cacheable by a shared cache, readers eventually see drafts. The cure for both is the same: one fetch helper that reads the state signal and chooses host, token, parameters and cache policy together, plus headers on every preview response that forbid shared caching and indexing.
Two further details decide whether preview feels trustworthy. Preview links from the CMS must open the exact page for the entry, including its locale, which means configuring the CMS’s preview URL template with slug and locale fields. And the preview must be recognizable as a preview: a persistent banner with the content state, the last save time and an exit link prevents both “my change is not showing” reports from editors who are unknowingly on the live site and “the live site looks wrong” reports from editors who forgot they were in preview.
The Publish Pipeline: Webhooks, Rebuilds and Timing
Publishing is where the editorial plane hands over to the delivery plane, and the handover happens through exactly one channel: a signed webhook. The receiving route verifies the signature on the raw body, filters out draft events, maps the changed entry to cache tags or routes, and either revalidates those tags or triggers a build. For static sites, bursts of publishes should be debounced into a single build of the final state; for incremental regeneration, tag invalidation is cheap enough to run per event. Either way, the handler acknowledges quickly, processes asynchronously, and treats every delivery as possibly duplicated.
Timing is the part editors notice. A publish should appear within seconds on sites with incremental regeneration and within one build plus a debounce window on static sites. Scheduled publishes and releases need a backstop, because some platforms fire no webhook at the scheduled moment and pre-launch 404s can linger in caches. Scheduled publishing and release windows covers the backstop, and rolling back published content covers the path back when a publish was wrong.
Editorial Experience and Accessibility
Preview is a tool used all day by editors, and its quality determines whether they trust the headless stack. Live updates while typing remove the save, switch and reload loop; click-to-edit overlays answer “where do I change this?” without documentation; share links let outside reviewers see drafts without CMS accounts. None of this may come at the cost of accessibility: editors include people who use keyboards and screen readers, and a preview that steals focus on every update, traps the keyboard inside an iframe or announces nothing when content changes excludes them from publishing. The accessibility topic covers live regions, focus management and keyboard navigation for exactly these dynamic preview situations, as well as the content-model fields that make accessible output possible in the first place.
Performance matters in preview too, in a different way than on the public site. Editors keep previews open for hours, so analytics scripts, chat widgets and heavy animations should be disabled in preview mode, and live updates should patch the changed entry instead of refetching the whole page. A preview that consumes a CPU core in the background gets closed, and editors fall back to publishing to check their work, which is exactly the habit a good preview exists to end.
Migrating Preview from a Legacy CMS
Many headless projects start as migrations from a monolithic CMS, and preview is often the feature editors are most afraid of losing. During the migration window, both systems must preview correctly: legacy-managed content through the legacy preview, migrated content through the headless draft route, chosen by the same routing table that decides which system serves public traffic. Legacy system decoupling strategies covers the strangler routing, parallel running, content audits and redirects that make such migrations reversible route by route, and the preview side follows the same rule: move a content type’s preview in the same configuration change that moves its public route.
Preview for Multilingual and Multi-Channel Content
Localized sites add a dimension to every preview decision. The preview link from the CMS must open the entry in the locale the editor is working on, which means passing the locale through the token and the redirect, and the preview must resolve fallback locales exactly as production does, or translators approve pages that render differently for readers. When a translation is still a draft while the source language is published, preview should show the draft translation over the published source, and the banner should say which locales are in draft.
Multi-channel delivery adds another. The same entry may appear on a website, in a mobile app and in an email template, each rendered by a different frontend. Editors need to preview each channel, and each channel needs its own preview route that accepts the same token format. A small preview hub page, opened from the CMS, that lists the channels an entry appears in and links to each channel’s preview is often the simplest way to make that manageable. The same principle applies to multi-tenant setups: the token names the tenant, and each tenant’s frontend verifies it independently.
Costs and Capacity
Preview traffic is small compared with public traffic, but it is uncached, so each preview request costs a full render and a round trip to the CMS preview API. For large editorial teams, that load is noticeable. Deduplicate draft fetches within a request, prefer SDK-driven patching over full refetches for live editing, and watch the CMS’s preview API rate limits, which are often lower than delivery limits. On static sites, avoid rebuilding preview deployments on every draft save, which can consume a month’s build allowance in a week; an on-demand preview route removes that cost entirely.
The publish pipeline has its own capacity profile. Bulk publishes and releases send bursts of webhooks, and each can trigger regeneration and CDN purges. Debounce builds, batch tag invalidations for releases, and make sure the revalidation work happens in a queue rather than inside the webhook request, so a burst never turns into timeouts and retry storms.
Choosing a Starting Point
Teams rarely build everything in this section at once, and they should not. A sensible order follows the size of the payoff and the risk each step removes:
- Make preview correct. A draft route with a token exchange, one fetch helper, uncached responses and a preview banner. This alone ends the most common editorial complaints and closes the most common leak.
- Make publishing reliable. A verified, idempotent webhook route that revalidates tags or triggers debounced builds, plus a synthetic probe for publish-to-visible latency.
- Harden access. Per-entry scopes, share links for outside reviewers, key rotation and, where drafts are sensitive, single sign-on in front of preview routes.
- Add live editing where editors build visually. Use the platform SDK, add click-to-edit, and authenticate any custom streams.
- Audit accessibility of the whole editorial path. Keyboard, screen reader and live-region behaviour in preview, plus content-model fields that make accessible output possible.
Each step stands on its own, so the editorial experience improves after every one, and each step’s guide lists the configuration and edge cases that matter at that point.
Platform & Tooling Landscape
| Need | Tooling | Guide |
|---|---|---|
| Draft mode and state fork | Next.js draftMode, Nuxt preview mode, Astro on-demand routes |
Draft state management |
| Signed preview tokens | jose (JWT), HMAC signatures, JWKS for asymmetric keys |
Token-based authentication |
| Live preview | Contentful Live Preview SDK, Sanity Presentation and visual editing, Storyblok Bridge | Live editing patterns |
| Publish pipeline | CMS webhooks, revalidateTag, build hooks, queues and Redis |
Webhook-triggered rebuilds |
| Accessible previews | axe-core, eslint-plugin-jsx-a11y, screen reader testing | Accessibility compliance |
| Migrations | edge middleware, redirect maps, extraction pipelines | Legacy decoupling |
The CMS matters more here than in any other section, because preview and publish mechanisms are where platforms differ most. Contentful separates delivery and preview APIs by host; Sanity overlays drafts through perspectives; Storyblok selects versions per request; Strapi and Directus model state as fields. Webhook payloads and signing schemes differ as well, which is why the platform deep dives include per-platform guides for webhook verification and preview setup.
Operational Concerns
Preview and publishing fail in ways that are invisible to engineers and obvious to editors, so monitoring must look at outcomes. Three signals catch nearly everything. Publish-to-visible latency, measured by a synthetic probe that edits and publishes a test entry and polls the public URL, shows whether the publish pipeline works end to end. Preview errors, logged from the preview route with reasons such as expired token, invalid signature or draft fetch failure, show whether editors can review their work. Cacheable preview responses, detected by an alert on any preview response that carries public caching headers, catch the most damaging class of bug before a draft reaches a shared cache.
Security operations belong here too. Rotate preview signing keys and webhook secrets on a schedule with overlap windows, log preview session starts and share-link creation with enough detail to answer “who could see this draft”, and review the CMS’s webhook delivery log after every secret change. The worst preview incidents are not dramatic attacks; they are a secret left in a URL template for three years or a webhook that silently failed for four days after a rotation.
Implementation Checklist
Governance and Audit
In regulated industries, preview is also an audit question: who saw which draft, when, and who approved its publication. The patterns in this section produce the raw material for answering that. Minted tokens name the entry and editor; share links record their creator and recipient; SSO-gated previews log the person behind every view; webhook handlers log every publish with its revision. Bring those streams together in one place, retain them as long as your compliance rules require, and connect them to the CMS’s own workflow history, where approvals are recorded. The enterprise governance topic covers approval chains, role-based access and audit trails on the CMS side, which complete the picture that the preview and publish logs start.
Testing the Editorial Path
The editorial path deserves the same automated coverage as the public site, because a broken preview blocks every editor at once. Three end-to-end tests cover most regressions: a signed preview link opens the draft of a test entry with uncached, non-indexed headers; an anonymous browser context never sees that draft; and a publish through the management API reaches the public URL within the latency budget. Run them on every deploy against staging, and run the publish probe continuously against production. The automated testing topic covers fixtures, signed webhook payloads and staging environments for exactly these checks.
Frequently Asked Questions
Should preview run on the production domain or a separate host?
The production domain with a draft-mode cookie shows exactly what readers will see and needs no extra deployment, which suits most sites. A separate, uncached preview host gives stronger isolation from caches and search engines and suits organizations with sensitive drafts. Both work if the boundary is tested.
Do we need live editing?
Not always. Teams that build pages visually, such as landing pages and campaigns, benefit greatly. Teams that write long-form articles are often well served by a fast save-and-refresh preview. Start with a solid preview route and add live editing where editors ask for it.
Why not reuse the CMS login for preview access?
The CMS session lives on the CMS’s origin and cannot be read by your frontend. Tokens minted by the CMS bridge the two origins deliberately and briefly, and they can carry the scope and expiry that a login session does not.
How do we stop drafts from appearing in search results?
Serve previews only after a token exchange, send X-Robots-Tag: noindex on every preview response, never link to preview URLs from public pages, and block separate preview hosts with authentication. Share links should expire, because they are the preview URLs most likely to be posted somewhere public.
What is the single best indicator that this section’s patterns are working?
Editors stop asking whether their changes are live. Behind that, publish-to-visible latency measured in seconds and a preview error rate near zero.
How do previews work for pages assembled from several entries?
The preview route fetches the page entry and resolves its references with the preview API, so every referenced draft appears in place. Scope tokens to the page, and let its references through, rather than minting one token per referenced entry.
Can preview work offline or on slow connections?
Preview depends on the CMS preview API, so it needs connectivity. Keep previews light, avoid unnecessary scripts in preview mode and show clear errors when the API is unreachable, so editors on poor connections know what is happening.
Who should own preview in a headless team?
The frontend team owns the preview route, tokens and publish pipeline; content operations owns the CMS preview configuration and editorial guidance. Name one owner for the end-to-end experience, or problems at the boundary between the two go unfixed.