Skip to content
All posts

Why Astro and Contentful make a fast, editable marketing site

How pre-rendering with Astro and a headless CMS gives you a site that is quick for visitors and easy for editors to change.

Matt Claffey · 2 min read

A marketing site has two jobs: load quickly and be easy to change. Most stacks are good at one and awkward at the other. A hand-coded site is fast but every copy tweak needs a developer. A traditional CMS is easy to edit but drags a server, a database and a plugin ecosystem into every page view.

Astro and Contentful split those jobs cleanly.

Pre-render everything

Astro renders pages to plain HTML at build time. Visitors get a document with no framework runtime unless a component genuinely needs one, which keeps Core Web Vitals healthy without heroic optimisation work.

When a page does need interactivity, like a filter on a listing page, Astro lets you hydrate just that component as an "island". Everything around it stays static HTML.

Let editors own the words

Contentful holds the copy as structured content: a homepage has a heading, a body, calls to action and SEO fields, not one big blob of HTML. That structure is what makes the content reusable and safe to edit. An editor can change the hero heading without any risk of breaking the layout.

The site reads that content through Contentful's GraphQL API during the build, not when someone visits. There's no API call on page load, no token in the browser, and no CMS outage that can take the site down.

Close the loop with a webhook

The catch with pre-rendering is that publishing in the CMS doesn't change the live site by itself. A Contentful webhook that calls your host's build hook fixes that: publish, and the site rebuilds in about a minute.

Build in safety rails

Two rules make this production-friendly:

  • No credentials, use local content. A fresh checkout still builds from a JSON fallback, so developers aren't blocked.
  • Credentials but a failed request, fail the build. Never silently deploy stale or empty content.

The trade-off

There's a build step between publishing and going live. For a marketing site, about a minute is a fair price for pages that are fast by default, content that is structured and typed, and a short path from edit to production.