Next.js Headless CMS SEO: A Practical Checklist for AI-Built Websites
A headless CMS won't rank your site on its own. Seven checks for Next.js App Router sites: crawlable URLs, real 404s, metadata from content, server rendering, freshness, sitemaps and measurement.
Aditya Kadam
Garchi CMS
Moving your blog from hard-coded files into a headless CMS makes publishing easier. It doesn't make Google like your site more. Rankings come from useful content, pages search engines can reach and read, and a lot of signals that live outside any CMS.
In a Next.js site, the split is clear. The CMS supplies titles, summaries, bodies and images. Your frontend turns them into HTML, URLs, metadata and sitemaps. If an AI coding tool scaffolded that frontend in an afternoon, some of those pieces are probably missing.
This checklist covers the seven things to verify on a Next.js App Router site that reads its content from a headless CMS. Examples use Garchi CMS, which we build, but every check applies to any CMS. The code uses the getPosts, getPost and meta helpers from lib/garchi.ts in our guide to building a blog on Garchi.
1. Every article has one stable, crawlable URL
Your blog index should link to each post with a normal <a href>, which Next.js's Link component renders. Avoid click handlers that change the route without a link. Search engines follow links, not JavaScript events.
Then check three behaviours:
- Slugs are readable and permanent. Changing a slug breaks every link to the old URL unless you add a redirect.
- Unknown or unpublished slugs return a 404 status, through
notFound(). An empty article template with a 200 status is a soft 404 and wastes crawl time. - Each post has one URL. If
/blog/my-postand/blog/my-post/both resolve, set a canonical.
const post = await getPost(slug);
if (!post?.item_id) notFound();
2. Titles and descriptions come from the content
Use generateMetadata to build each page's metadata from the post you fetched. Garchi data items have a name and a one-line summary, which map to the title and the meta description. Add a canonical URL and an Open Graph image while you're there.
export async function generateMetadata({ params }) {
const { slug } = await params;
const post = await getPost(slug);
if (!post) return {};
return {
title: post.name,
description: post.one_liner,
alternates: { canonical: `https://example.com/blog/${post.slug}` },
openGraph: { images: post.main_image ? [post.main_image] : [] },
};
}
If you want SEO titles that differ from on-page headings, add an seo_title metadata key in the CMS and fall back to the name when it's empty. Then view the page source in production to confirm the tags are in the HTML, not added later by client code.
3. Content renders on the server, and safely
Server components fetch on the server by default, which gives crawlers complete HTML on the first response. Keep it that way. If your agent moved data fetching into a client component with useEffect, move it back. Google can render JavaScript, but it does so in a later pass, and other crawlers may not render it at all.
Inside the article:
- One H1, the post title. Use H2 and H3 for sections.
- Alt text on every meaningful image.
- Descriptive link text instead of "click here".
- Sanitised HTML. CMS bodies arrive as HTML, so run them through a sanitiser such as
sanitize-htmlbefore rendering, whoever wrote them.
Keep your CMS API key in a server-only environment variable. Never give it a NEXT_PUBLIC_ prefix.
4. Published edits reach the page on a known schedule
When an editor publishes a correction, the CMS changes at once. Your cached page may not. Decide how fresh each route needs to be:
- Time-based:
export const revalidate = 3600on the article route refreshes the page at most once an hour after a request. - On demand:
revalidatePathorrevalidateTagin a route handler, called by whatever triggers your publish flow.
Caching APIs have changed across Next.js releases, so check the docs for the version you run before copying older snippets. Then test the whole loop: publish an edit, note the time, and reload until it appears.
5. A sitemap lists the URLs you want indexed
Generate the sitemap from the same source as your pages, so new posts appear without a code change. The getPosts helper returns nine posts per page, so loop until a page comes back short:
// app/sitemap.ts
import type { MetadataRoute } from "next";
import { getPosts, meta } from "@/lib/garchi";
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const entries: MetadataRoute.Sitemap = [];
for (let page = 1; ; page++) {
const { data } = await getPosts(page);
for (const post of data) {
entries.push({
url: https://example.com/blog/${post.slug},
lastModified: meta(post).published_date,
});
}
if (data.length < 9) break;
}
return entries;
}
Garchi's API returns published items only, so drafts stay out of your sitemap. Add an app/robots.ts that points to the sitemap, and check no environment ships a stray noindex. A staging setting copied to production is a typical way that happens.
6. Structured data matches what's on the page
Add Article JSON-LD with the headline, date, author and image, taken from the same fields you render. Keep it honest: markup must describe visible content, and valid markup doesn't guarantee rich results. Google decides whether to show them.
7. You measure the right things
Connect Google Search Console, submit the sitemap and run URL Inspection on a couple of posts. Check the rendered HTML Google sees matches what you expect.
Then track non-brand clicks, the pages people land on, and what they do next, such as sign-ups or enquiries. Impressions alone tell you little about whether the blog works for the business.
What the CMS does and what your code does
| Garchi CMS handles | Your Next.js code handles |
|---|---|
| Storing titles, slugs, summaries, bodies, images and custom fields | URLs, status codes and redirects |
| Drafts, publishing and scheduling | Metadata, canonicals and Open Graph tags |
| Serving published content only through the API | Server rendering and HTML sanitising |
| Restore points for content edits | Caching, sitemaps, robots and structured data |
If you'd rather your coding agent wrote the frontend part, install the Garchi agent skills with npx skills add lumenharbor/garchi-cms-skills. Then give it this checklist and review the diff.
A working definition of "done"
A post is ready for search when a crawler can reach it from a link, the URL returns 200, the HTML carries its own title and description, it appears in the sitemap, and Search Console inspects it without errors. After that, the content has to earn its rankings.
New to the setup? Start with building a blog on Garchi data items or adding a CMS to a Claude Code site.
Enjoyed this article?
Get the next one in your inbox, with new Garchi features and practical ideas for running content operations with your team and AI agents. No spam, and you can unsubscribe at any time.