React & Next.js SEO

Next.js SEO Checklist: 20 Things Every Page Needs

A Next.js SEO checklist for the App Router: 20 items with the exact code (metadata, sitemap, canonical, JSON-LD) and a one-minute test for each before launch.

Why trust this guide: I've shipped 40+ live production websites in React and Next.js as the sole frontend developer on each build, I build custom Next.js stores for clients at Devrex Digital, and I built the free SEO audit tool that checks a page's raw HTML for most of the items on this list.

Part of the guide: React SEO Guide: How to Make React and Next.js Sites Rank

This Next.js SEO checklist is the list I go through on every App Router site before it goes live: a title, description and canonical URL on every page, a sitemap and robots file generated from code, content in the HTML, real not-found statuses, structured data, social images and fast images and fonts. Below are all 20 items, the code for each and a quick test, so you can check a site yourself or check your developer's work.

The Next.js SEO checklist: all 20 items

Tick these off page type by page type (home, service, product, post), not just on the home page.

Metadata

  • Every page has its own title, with the main keyword near the start.
  • Every page has its own meta description that gives a reason to click.
  • metadataBase is set once in the root layout.
  • Every page has a canonical URL pointing to its own clean address.
  • Open Graph and Twitter tags are set, so shared links show a proper card.
  • Dynamic pages (products, posts) use generateMetadata.

Crawling

  • app/sitemap.ts lists every public URL, built from your data.
  • app/robots.ts allows public pages, blocks admin and API routes and points to the sitemap.
  • Preview and staging deploys tell Google not to index them.
  • The sitemap is submitted in Google Search Console.

Content in the HTML

  • The main content is rendered on the server, not fetched in the browser.
  • One H1 per page, headings in order.
  • Internal links are real links (next/link), not click handlers.
  • Missing pages call notFound() and send a real not-found status.
  • Moved pages have permanent redirects.
  • One version of every URL (www or not, with or without a trailing slash).

Rich results and sharing

  • Structured data (JSON-LD) is in the page, escaped.
  • Each route has an opengraph-image.

Speed

  • Images use next/image with a width and height, and the main image above the fold loads first.
  • Fonts load through next/font, self-hosted, with a fallback that matches their size.

How do I add SEO to Next.js with the Metadata API?

The six metadata items are all done through the Next.js Metadata API. You don't need next/head or a package like next-seo in the App Router. Several top-ranking checklists still show next/head in App Router code; it doesn't work there.

Set metadataBase once in the root layout. Without it, a relative canonical or image path stays relative, and Google and chat apps can't use it.

// app/layout.tsx
import type { Metadata } from "next";

export const metadata: Metadata = {
  metadataBase: new URL("https://example.com"),
  title: { default: "Example Store", template: "%s | Example Store" },
  openGraph: { siteName: "Example Store", type: "website" },
};

Then each static page exports its own title, description and canonical. The template above adds the store name after every page title for you.

// app/services/page.tsx
export const metadata = {
  title: "Custom Next.js Stores",
  description: "Custom online stores with an admin dashboard, built to load fast and rank.",
  alternates: { canonical: "/services" },
};

For pages built from data, use generateMetadata. Since Next.js 15, params is a Promise, so await it. Most examples online still skip that, and the code then fails the type check.

// app/products/[slug]/page.tsx
import type { Metadata } from "next";
import { getProduct } from "@/lib/products";

type Props = { params: Promise<{ slug: string }> };

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { slug } = await params;
  const product = await getProduct(slug);
  return {
    title: product.name,
    description: product.summary,
    alternates: { canonical: `/products/${slug}` },
    openGraph: { title: product.name, description: product.summary },
  };
}

That last line is the Next.js canonical URL: one per page, pointing at itself. It tells Google which address is the real one when the same page is reachable with tracking codes or filters in the URL. Google explains the reasons in its guide to consolidating duplicate URLs. The full list of fields is in the Next.js metadata docs.

Does Next.js generate a sitemap?

Not by itself, but it gives you a file for it. Add app/sitemap.ts, return your URLs, and Next.js serves the result at /sitemap.xml. Build the list from the same data as your pages, so the Next.js sitemap never goes out of date.

// app/sitemap.ts
import type { MetadataRoute } from "next";
import { getProducts } from "@/lib/products";

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const products = await getProducts();
  return [
    { url: "https://example.com", lastModified: new Date() },
    ...products.map((p) => ({
      url: `https://example.com/products/${p.slug}`,
      lastModified: p.updatedAt,
    })),
  ];
}

The robots rules go in app/robots.ts. This version is the one most checklists warn about but never show: it blocks every deploy that isn't production, so a preview link someone shares never ends up in Google.

// app/robots.ts
import type { MetadataRoute } from "next";

export default function robots(): MetadataRoute.Robots {
  if (process.env.VERCEL_ENV !== "production") {
    return { rules: [{ userAgent: "*", disallow: "/" }] };
  }
  return {
    rules: [{ userAgent: "*", allow: "/", disallow: ["/admin", "/api/"] }],
    sitemap: "https://example.com/sitemap.xml",
  };
}

If you host somewhere other than Vercel, use your own environment variable for the check. Then submit the sitemap once in Search Console. The options for large sites, such as splitting it into several files, are in the Next.js sitemap file convention docs.

Content, status codes and redirects

The six content items decide whether Google gets a real page at all.

Server-rendered content. Next.js renders on the server by default, but a page that loads its products with a fetch inside useEffect sends an empty list to crawlers, just like a plain React app. Load the main content in a server component and keep client components for clicks, menus and carts. The difference is explained in my comparison of React vs Next.js for SEO.

Headings and links. One H1 that matches what the page is about. Internal links through next/link, which renders a real <a href> that Google can follow. A button that changes the page with JavaScript is not a link to a crawler.

Not-found pages. When a product doesn't exist, call notFound() from next/navigation. Next.js then sends a real 404 status with your not-found page. Showing "Product not found" with a 200 status is what Google reports as a soft error.

import { notFound } from "next/navigation";

const product = await getProduct(slug);
if (!product) notFound();

Redirects and one version of each URL. Put moved pages in redirects() in next.config.ts with permanent: true, which sends a 308. Pick www or no www and redirect the other one there, and keep the default trailing slash setting so every page has one address.

Structured data, social images and speed

JSON-LD. Put it in a <script type="application/ld+json"> tag inside the page component. Escape < first. A product name or review that contains </script> can otherwise close the tag early and break the page. None of the top checklists mention this.

const jsonLd = (data: object) => ({
  __html: JSON.stringify(data).replace(/</g, "\\u003c"),
});

<script type="application/ld+json" dangerouslySetInnerHTML={jsonLd(productSchema)} />

Social images. Add an opengraph-image.tsx file next to a page and Next.js generates the image and the meta tags for it. One file per page type (post, product, service) is enough; each page fills in its own title. If shared links still show no image, my fixes for Open Graph tags that don't show a preview cover the usual causes.

Images and fonts. next/image with a width and height reserves the space, so the page doesn't jump while it loads. Give the main image at the top priority and nothing else. Load fonts with next/font, which self-hosts them, and keep display: "swap" so text shows at once in a fallback font. These are the Next.js SEO best practices for speed that matter most in real audits; the rest of speed work is in the React SEO guide.

Free SEO audit tool

Free SEO audit: see what's stopping your site from ranking

Enter your website to get a score out of 100 and a fix list, checked the way Google reads your page. Free, no sign-up.

How do I test each item before launch?

This is the part most checklists leave out. Each test takes about a minute and needs no developer tools beyond a browser.

ItemTest
Title, description, canonical, social tagsOpen the page, right-click, "View page source", search for <title, description, canonical and og:
SitemapOpen /sitemap.xml; check new products and posts are there with full URLs
Robots and preview deploysOpen /robots.txt on the live site and on a preview link; the preview should say Disallow: /
Search ConsoleSitemaps report shows "Success" and the number of discovered URLs
Content and headings in the HTMLIn "View page source", search for a sentence you can see on the screen
LinksIn the page source, internal links appear as <a href="/…">
Not-found pagesRun curl -I https://example.com/products/does-not-exist and look for 404
Redirects, one version of each URLRun curl -I on the old URL and the www version; each should answer 308 or 301 to the main address
Structured dataPaste the URL into Google's Rich Results Test
Social imagesPaste the link into a chat app, or open the og:image URL from the page source
Images and fontsRun PageSpeed Insights on mobile; look at the layout shift and largest paint lines

After launch, use the URL Inspection tool in Search Console on one page of each type. It shows the HTML Google rendered and whether the page is indexed. If pages stay out of the index, work through my steps for a React site not indexed by Google.

What does it cost to have this done?

If you'd rather not work through the list yourself, these are my starting prices:

WorkFromTime
SEO audit (report + prioritized fix list)$1502–3 days
Technical SEO setup for React / Next.js$500Quoted after a free call
React (Vite/CRA) to Next.js migration for SEO$800Quoted after a free call

The audit covers every item on this checklist and tells you which ones are missing on your site and in what order to fix them. The setup is the work itself, done once per page type. Both are part of my React and Next.js SEO service.

Frequently asked questions

How do I add SEO to Next.js?

Export a metadata object (or a generateMetadata function for dynamic pages) from each page with its title, description and canonical URL, set metadataBase once in the root layout, and add sitemap.ts and robots.ts in the app folder. Keep the main content rendered on the server so it's in the HTML.

Does Next.js generate a sitemap?

Not on its own, but it gives you the file for it. Add app/sitemap.ts that returns your URLs and Next.js serves it at /sitemap.xml. Build the list from the same data as your pages, so new products and posts appear without anyone editing a file.

How do I set a canonical URL in Next.js?

Set alternates.canonical in the page's metadata, for example '/products/silk-waistcoat'. With metadataBase set in the root layout, Next.js turns it into a full URL in the HTML. Every page should point to its own clean address.

Do I still need next-seo or next-sitemap?

Not with the App Router. The built-in Metadata API covers titles, descriptions, canonicals and social tags, and sitemap.ts and robots.ts replace the sitemap package. Fewer packages means fewer things that break on an upgrade.

How do I stop preview deploys from being indexed?

Make app/robots.ts check the environment and return 'Disallow: /' for every deploy that isn't production. On Vercel that's process.env.VERCEL_ENV; elsewhere use your own variable. Then open /robots.txt on a preview link to confirm it.

Next step

Is your React site invisible on Google?

SEO audits from $150 and React to Next.js migrations from $800, without changing your design.

Keep reading

Related posts

React & Next.js SEO8 min read

React Open Graph Tags Not Working? Why Links Show No Preview

React Open Graph tags not working? Why WhatsApp and Slack show no preview, the server-side fix, and five Next.js mistakes that still break link cards.

Read the post
React & Next.js SEO8 min read

Create React App SEO Problems and How to Fix Them

Create React App SEO problems fixed in order of cost and effect: meta tags, prerendering or Next.js, plus the Vite trap nobody mentions and real prices.

Read the post
React & Next.js SEO8 min read

React vs Next.js for SEO: What Google Sees in Each

React vs Next.js for SEO, decided by the HTML each one sends to Google. See both side by side, which site types need Next.js, and what switching really costs.

Read the post