Skip to content
Web Development

Is a Headless CMS Good for SEO? What to Set Up

Is a headless CMS good for SEO? Yes, if the site is built right. The checklist: rendering, SEO fields, URLs, sitemaps, redirects, images and page speed.

Keshur Gojiya

7 min read

Is a Headless CMS Good for SEO? What to Set Up

Yes, a headless CMS is good for SEO when the front end does its job. The CMS only stores your content; search engines never see it. They see the HTML your website sends, and if that HTML arrives complete, with the right titles, links, structured data and good speed, a headless site can rank as well as any other and is often faster. What changes is that SEO features no longer come from a plugin: each one has to be built into the content model and the front end.

Is a headless CMS good for SEO on its own?

On its own, it neither helps nor hurts. Google doesn't know or care which CMS you use. It crawls URLs, reads the HTML, follows links and looks at how pages perform for visitors. A headless CMS such as Sanity or Contentful only separates the content from the website: editors write in the CMS, and a separate front end turns that content into pages.

With a traditional CMS, an SEO plugin adds title fields, a sitemap and canonical tags for you. With a headless set-up, none of that exists until someone builds it, which also means you get exactly the fields your site needs. These are the pieces that have to be in place.

Render the HTML on the server, not in the browser

The most important decision is how pages are rendered. With server-side rendering or static generation, the server sends HTML that already contains the headline, text and links. With purely client-side rendering, the server sends a nearly empty page, and JavaScript fetches the content from the CMS in the visitor's browser.

Google can run JavaScript, but it puts pages in a rendering queue first. Its own documentation says server-side or pre-rendering is still a great idea because it makes sites faster for users and crawlers, and because not all bots can run JavaScript.

A quick test: open a page, right-click and choose View page source (not Inspect). If your main heading and body text are in that source, the content is server-rendered. Frameworks such as Next.js, Nuxt and Astro do this by default when they are set up properly.

Give every page type its own SEO fields

Each page type in the CMS needs:

  • an SEO title and meta description, with sensible fallbacks (such as the page title plus your brand name) and a warning in the editor when they are empty or too long
  • a social image for link previews, with a site-wide default
  • a noindex option for pages that shouldn't appear in search, such as thank-you pages
  • an optional canonical URL override for content that is also published elsewhere

I build these as one reusable SEO group that every page type includes, so a new page type can't ship without them. When I build Next.js websites with Sanity CMS, editors see these fields on every page from the first day, with help text explaining what each one does in search results.

Then check the result. In the page source, the head of each page should contain tags like these, filled from the CMS:

<title>Commercial Roof Repairs in Leeds | Example Roofing</title>
<meta name="description" content="Flat and pitched roof repairs for offices and warehouses in Leeds.">
<link rel="canonical" href="https://www.example.com/services/roof-repairs">
<meta property="og:title" content="Commercial Roof Repairs in Leeds">
<meta property="og:image" content="https://www.example.com/og/roof-repairs.jpg">
  • Give each document a slug field that is generated from the title, checked for uniqueness, and written in lowercase with hyphens.
  • Build the canonical URL from the slug as a full address, and pick one version of every URL (with or without www, with or without a trailing slash).
  • Store internal links as references to other documents rather than pasted URLs, so they update when a slug changes.

Open Graph tags (og:title, og:description, og:image) control how a page looks when shared on LinkedIn, Facebook, WhatsApp or Slack. Their main job is earning clicks from shared links, and a link shared with a blank or wrong preview gets fewer of them. Give editors an image field, fall back to the page's main image or a site default, and output an absolute image URL.

Structured data built from your content

Structured data describes a page in a vocabulary search engines understand: an organisation, an article with an author and dates, a product, breadcrumbs. Google recommends JSON-LD in most cases. Valid structured data makes a page eligible for rich results; it doesn't guarantee them.

Here a headless CMS has a real advantage: the content is already structured. The author, publish date, category and main image are separate fields, so the front end can generate accurate JSON-LD on every page instead of someone pasting markup by hand.

An XML sitemap generated from the content

Build the sitemap from the published documents in the CMS, so new pages appear automatically and deleted ones disappear. A few rules, based on Google's documentation:

  • Include only the canonical, indexable URLs you want in search results. Leave out drafts, noindex pages and URLs that redirect.
  • Set lastmod from the document's last real update. Google uses it only when it is consistently accurate, and it ignores priority and changefreq.
  • One sitemap file can hold up to 50,000 URLs or 50 MB uncompressed; larger sites use a sitemap index.

Submit the sitemap in Google Search Console and reference it in your robots.txt.

Redirects that editors can manage

URLs change: a service is renamed, a post gets a better slug, two pages are merged. A redirects document type in the CMS, with a "from" path, a "to" path and a permanent option, lets editors handle this without waiting for a developer. The front end returns a 301 or 308 status for each rule, which Google treats as a signal that the new URL should replace the old one.

Moving from WordPress? Map every old URL before launch. The free WordPress to Next.js redirect generator turns a list of WordPress URLs or a sitemap into redirect rules.

Image alt text, sizes and page speed

  • Make alt text a field on every content image, with a validation warning when it is empty.
  • Serve images through the CMS's image CDN at the size each screen needs, in modern formats such as WebP or AVIF. Sanity and Contentful both resize images through URL parameters.
  • Give images a width and height (or an aspect ratio), so the layout doesn't jump while they load.
  • Fetch only the fields each page needs, and cache the results.

Speed is where a well-built headless site often has an edge, because the front end only sends what each page uses.

Common headless CMS SEO pitfalls

  • Content rendered only in the browser, so the first HTML is nearly empty.
  • Missing metadata fields, leaving every page with the same title and no description.
  • No sitemap, or one that lists drafts, preview URLs or redirected pages.
  • Preview and staging sites open to Google. Protect them with a password or a noindex header.
  • Deleted content that still returns a 200 status. A missing page should return a real 404, or Google may report it as a soft 404.
  • Broken URLs after a migration, because nobody mapped the old addresses to the new ones.

FAQ

Is WordPress better than a headless CMS for SEO?

Neither is better by default. WordPress gets SEO features quickly through plugins; a headless CMS needs them built in, in return for full control and often a faster site. A well-built site on either can rank well.

Does Google index websites that use a headless CMS?

Yes. Google indexes the HTML your website serves, wherever the content is stored. Server-rendered or statically generated pages are the safest, because the content is in the HTML from the first request.

Do I need an SEO plugin for Sanity?

No. In Sanity, the SEO fields are part of your content schema, and the front end outputs the tags. Your developer adds them once and every page type uses them.

How can I check what Google sees on a headless site?

Use the URL Inspection tool in Google Search Console and test the live URL to see the HTML Google renders. For a quick check, view the page source and confirm the main text, title and canonical tag are there.

Key takeaways

  • A headless CMS is good for SEO when the front end sends complete HTML, rendered on the server or at build time.
  • Every page type needs SEO title, description, slug, social image and alt text fields, with fallbacks and editor warnings.
  • Generate the sitemap, structured data and redirects from the content, so they stay correct as editors publish.
  • Most headless SEO problems come from features nobody built, not from the CMS itself.

Tags

  • SEO
  • Sanity CMS
  • Best Practices

About Keshur Gojiya

Web developer and HTML email specialist with 6+ years of experience, building websites and emails for businesses, startups and agencies.

Get to know me
Keep Reading
View All Articles
  • Web Development

    7 min read

    WordPress to Next.js Migration Checklist: 6 Stages in Order

    A WordPress to Next.js migration checklist in six stages: audit, build, redirects, staging QA, launch day and the first weeks, so nothing gets lost.

    • WordPress Migration
    • Next.js
    Keshur Gojiya
  • Web Development

    6 min read

    How to Hire a Next.js Developer: What to Check and Ask

    How to hire a Next.js developer: what to check in their work, questions to ask before you sign, red flags, freelancer vs agency, and how to write a clear brief.

    • Next.js
    • Best Practices
    Keshur Gojiya
  • Web Development

    6 min read

    How Much Does Website Maintenance Cost? What Sets the Price

    How much does website maintenance cost? What drives the price, how per-task, retainer and hourly pricing work, and what to ask before you hire a developer.

    • Web Performance
    • Best Practices
    Keshur Gojiya

Need help with an email or website?

If an email is breaking in Outlook or dark mode, or you have a design that needs building, tell me about it and I’ll reply with next steps.

Email me