CMS for Astro: content, previews and updates in 2026

Publish CMS content through Astro with a clear update model. Compare local files and external sources, validate records and check the deployed policy page.

An Astro CMS setup works best when the editing workflow matches the way pages update. Use local content files for reviewed developer-led publishing, or an external CMS when editors need their own workspace. Choose the preview and release process at the same time: a saved policy change can leave a static storefront showing its previous text.

Choose files, an external CMS or a full-stack approach

Astro is the frontend framework that turns content into pages. A content management system (CMS) supplies the editing and storage workflow. Connecting one requires a decision about who edits content and what makes an approved edit public.

For a small retail team, local Markdown or structured files keep buying guides beside the site’s code. Editors need repository access or an editing interface that writes those files. Review can happen through a proposed change, followed by a build and deployment. This suits teams that already involve a developer in publication.

An external CMS separates the editor’s workspace from the frontend. Developers map its records into Astro templates and configure credentials and delivery queries. Editors can change content without editing templates, but static pages still need a rebuild. A separate service also introduces permissions and an availability dependency.

A full-stack CMS adds an application that manages editing and persistent content storage. If you host it yourself, someone must own its database backups and application updates. Astro’s rendering features alone don’t supply that editorial application. Keep the commerce system responsible for orders and stock whichever content route you choose.

Model and validate the content source

Give policies and buying guides explicit fields and stable identifiers, then validate the records before rendering them. Keep a product reference separate from an editorial description so a guide cannot become an accidental price database.

The following fictional records illustrate a store’s content contract. The identifiers stay unchanged when a title changes.

{
  "policies": [{
    "id": "delivery-au",
    "title": "Delivery",
    "status": "published",
    "revision": "delivery-r8",
    "body": "Dispatch takes two business days.",
    "productSource": "catalogue-main"
  }],
  "guides": [{
    "id": "choosing-a-reading-lamp",
    "title": "Choosing a reading lamp",
    "status": "draft",
    "policyId": "delivery-au",
    "productIds": ["lamp-204"],
    "productSource": "catalogue-main",
    "image": "/images/reading-lamp.jpg"
  }]
}

Here is an illustrative schema for records loaded from separate local files. The product identifier names an item in the commerce catalogue, while policyId names a content collection entry.

import { defineCollection, reference } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';

const publication = z.enum(['draft', 'published']);
const policies = defineCollection({
  loader: glob({ pattern: '*.json', base: './content/policies' }),
  schema: z.object({
    title: z.string().min(1),
    status: publication,
    revision: z.string().min(1),
    body: z.string().min(1),
    productSource: z.literal('catalogue-main')
  })
});
const guides = defineCollection({
  loader: glob({ pattern: '*.json', base: './content/guides' }),
  schema: z.object({
    title: z.string().min(1),
    status: publication,
    policyId: reference('policies'),
    productIds: z.array(z.string().min(1)).min(1),
    productSource: z.literal('catalogue-main'),
    image: z.string().min(1)
  })
});
export const collections = { policies, guides };

Use filenames such as delivery-au.json as stable collection IDs for this example. Astro’s content collections documentation describes local loaders, remote loaders and schema validation. An invalid field produces a validation error. Remote data needs the same declared contract, whether it arrives through a custom loader or a provider client.

Add application checks for relationships. Resolve the policy reference and confirm each product ID exists in the authoritative catalogue. Reject the candidate build when a required reference is missing. A non-empty string schema alone cannot prove that a product exists or that an image loads.

Filter unpublished records when generating public routes and related links. Declaring a status field doesn’t enforce publication. For a requested guide that is missing or unpublished, return the site’s 404 page instead of rendering an empty guide.

Preview the change before release

Choose a preview that renders the content version the editor needs to approve. A local build of published records verifies the next public page, while an authenticated draft preview lets the editor review work before publishing it.

Sanity provides a maintained Astro integration. Its integration guide documents Visual Editing with a server-rendered preview. The sequence is to configure the content client, add the Visual Editing component, connect the Studio’s Presentation tool and enable stega metadata. Run the preview through Astro’s development server or a compatible server adapter.

Configure that private preview’s query with the draft perspective and an authorised read token. The editor then sees draft content through the preview, including edits that ordinary customers must not receive. The documented default refresh reloads the preview page after a document changes. A published-only query continues to show published content even when editing controls are present.

Keep read tokens in server-side environment variables. Restrict access to the preview and keep draft queries out of production builds. Disable editing overlays on public pages. A static deployment doesn’t acquire a private draft preview merely because it uses the same CMS.

For local files, review the proposed content change in a private candidate build. Check the delivery sentence and the referenced lamp image before merging it. That review sees the files included in that candidate, not later edits made elsewhere.

Publish and check the resulting page

An approved change becomes public through the site’s rendering route. For static Astro pages, publish the approved CMS record or merge the content files, then trigger a fresh build. Deploy only the successful candidate. If validation or content retrieval fails, retain the previous deployment and fix the failing record or credential before rebuilding.

For request-time delivery, Astro’s on-demand rendering guide requires a server adapter. The route must fetch the published record when it renders. Any response cache or cached content query adds its own expiry or invalidation step. Handle a failed upstream request explicitly so customers receive a controlled error instead of incomplete policy text.

Treat the fictional delivery-r8 correction as a release check. Open the ordinary customer policy URL and compare its dispatch sentence with the approved record. Follow its media references and open the buying guide that uses it. Confirm a private draft guide still returns 404 to an unauthenticated visitor.

If a shopping assistant reads store documents, check that source separately. A completed Astro deployment doesn’t prove that a document import or crawler has refreshed. Ask the delivery question through the customer interface and compare the answer with delivery-r8. If it still quotes the old rule, inspect that source’s refresh result before republishing the website.

Keep the previous approved record and deployment available for recovery. If the public page or connected answer contains the wrong policy, restore the correct version in each affected delivery path and repeat the same customer checks.

Give your store its own shopping agent

Customers ask in their own words. Your agent finds, compares and checks out from your catalogue, right on your site.

See it in actionFree trial · Simple setup