Skip to content
Sandeep Kumar
Updated 6 min read

A technical SEO checklist for the Next.js App Router

A technical SEO checklist for Next.js: canonical host, metadata, sitemap, robots, structured data, and the checks that catch regressions before they ship.

Sandeep Kumar, Full-stack EngineerSandeep KumarFull-stack Engineer
On this page
  1. 1. Settle the canonical host first
  2. 2. Build the head in one helper
  3. 3. Generate the sitemap and robots.txt as code
  4. 4. Keep thin pages out of the index
  5. 5. Write structured data as one graph
  6. 6. Core Web Vitals belong on this list
  7. 7. Verify in CI, not in Search Console
  8. Single sources of truth

Most Next.js SEO advice stops at "use the Metadata API", which covers the title and the description. Those are the two things least likely to be wrong.

The problems that cost traffic are quieter. A canonical that disagrees with the host. A sitemap that stopped matching reality three releases ago. Thin pages diluting the index. Structured data that validates and describes nothing.

This is the checklist I work through on an App Router project, in the order I work through it.

1. Settle the canonical host first

Every absolute URL on the site has to agree on one host. Canonical tags, Open Graph URLs, the sitemap, RSS, JSON-LD identifiers, all of them.

The most common Next.js SEO bug is a canonical pointing at the apex domain on a site served from www, where the apex then 301s back to www. Google is told the page's real address is elsewhere, follows that, and gets redirected back to where it started. The signal is contradictory and ranking suffers quietly, which is the worst way for anything to suffer. Google's own guidance on consolidating duplicate URLs is worth reading once properly.

One constant, used everywhere:

src/lib/site.tsts
export const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://www.example.com";

Then set metadataBase from that same value so every relative URL Next resolves inherits it:

src/app/layout.tsxts
export const metadata: Metadata = {
  metadataBase: new URL(SITE_URL),
  title: { default: "Site name", template: "%s | Site name" },
};

With metadataBase set, a page specifies alternates: { canonical: "/about" } and gets a correct absolute URL without repeating the host anywhere.

2. Build the head in one helper

Page-level metadata objects merge shallowly, and this catches almost everyone. Define openGraph on a page and it replaces the layout's openGraph entirely, including the siteName and the image you assumed were inherited. Sites find this out when half their pages share one preview card and the other half have none at all.

Build the whole set in one place and call it from every page:

src/lib/seo.tsts
export function pageMeta({ title, description, path, type = "website" }: PageMetaArgs): Metadata {
  return {
    title,
    description,
    alternates: { canonical: path },
    openGraph: {
      type, url: path, siteName: site.name, locale: "en_IN",
      title, description,
      images: [{ url: `${path}/opengraph-image`, width: 1200, height: 630 }],
    },
    twitter: { card: "summary_large_image", title, description },
  };
}

Two rules keep the output useful. Titles at 50 to 60 characters, descriptions at 150 to 160. Both get truncated past that, and the truncation reliably lands mid-phrase on the part that was doing the persuading. Keep the keyword in the first half where it survives.

3. Generate the sitemap and robots.txt as code

A hand-written public/sitemap.xml is accurate on the day you write it and decays from there. In the App Router both are route files, generated from the same source the pages read:

src/app/sitemap.tsts
export default function sitemap(): MetadataRoute.Sitemap {
  const posts = getAllPosts();
  const pages = ["", "/blog", "/about"].map((p) => ({ url: `${SITE_URL}${p}` }));
  return [...pages, ...posts.map((p) => ({ url: `${SITE_URL}/blog/${p.slug}`, lastModified: p.date }))];
}

lastModified is the part worth caring about. Without it, crawlers decide for themselves how often to return. With it, a genuine update becomes a signal rather than a guess, provided it reflects real edits and not a build timestamp. A lastmod that changes on every deploy teaches crawlers to ignore lastmod, which is worse than not having it.

src/app/robots.tsts
export default function robots(): MetadataRoute.Robots {
  return { rules: { userAgent: "*", allow: "/" }, sitemap: `${SITE_URL}/sitemap.xml` };
}

4. Keep thin pages out of the index

Most content sites generate pages nobody searches for. Tag archives, paginated listings, filter permutations. They are useful for crawling and useless as results, and at volume they dilute the crawl budget that should be spent on pages that matter.

src/app/blog/tag/[tag]/page.tsxts
export async function generateMetadata({ params }): Promise<Metadata> {
  return { ...pageMeta({ ... }), robots: { index: false, follow: true } };
}

follow matters as much as index: false, because crawlers should still traverse those links to reach the real content. Leave the same pages out of the sitemap too, since a sitemap entry for a noindex URL is a contradiction you are handing Google to resolve.

Routes that disappear need the same discipline. When a section is removed, 301 it rather than letting it 404:

next.config.tsts
async redirects() {
  return [
    { source: "/work/:slug", destination: "/blog", permanent: true },
    { source: "/resume", destination: "/about", permanent: true },
  ];
}

5. Write structured data as one graph

Scattered JSON-LD blocks that each re-declare the author produce several entities Google then has to reconcile, usually badly. Define the shared nodes once with an @id and reference them.

ts
{
  "@context": "https://schema.org",
  "@graph": [
    { "@type": "Person",  "@id": `${SITE_URL}/#person`, name: site.name, jobTitle: site.role },
    { "@type": "WebSite", "@id": `${SITE_URL}/#website`, publisher: { "@id": `${SITE_URL}/#person` } },
  ],
}

Then every article points at the same person:

ts
{
  "@type": "BlogPosting",
  headline: post.title,
  datePublished: post.date,
  dateModified: post.updated,
  author: { "@id": `${SITE_URL}/#person` },
  publisher: { "@id": `${SITE_URL}/#person` },
}

dateModified earns its place, because it is how a refreshed post is distinguished from a stale one. Add BreadcrumbList everywhere and FAQPage where a post genuinely answers questions.

Skip HowTo. Google retired it as a rich result, so the markup renders nothing and costs you the maintenance.

If you want this content surfacing in AI answers and not only in search results, structured data is most of the work. I went through the rest, and what the evidence actually supports, in llms.txt and GEO.

6. Core Web Vitals belong on this list

Technical SEO and performance stop being separate concerns at the point where a slow page is also a page that ranks lower. The current thresholds are LCP ≤ 2.5s, INP ≤ 200ms, CLS ≤ 0.1.

Three things carry most of the weight on a Next.js site. next/image with explicit dimensions, plus loading="eager" and fetchPriority="high" on the single above-the-fold image, so it is neither lazy-loaded nor shifting the layout. (priority is the pre-16 spelling of that and is now deprecated.) next/font, which self-hosts and preloads instead of round-tripping to a font CDN before any text can paint. And static rendering wherever the content allows it, so HTML comes off a CDN rather than being built per request.

The mechanics are in my Next.js performance guide, and the font and render-blocking work specifically in how I cut First Contentful Paint.

7. Verify in CI, not in Search Console

Search Console reports a regression weeks after it shipped, which makes it an archive rather than a safety net.

Everything above is machine-checkable against a built site. Exactly one <h1> per page with no skipped heading levels. Title at 60 characters or under, description between 150 and 160, both unique across pages. A rel="canonical" that is present, absolute and matches the served host. Every sitemap URL returning 200, and every indexable page present in the sitemap. No internal link returning a non-200. JSON-LD that parses and contains the types the page should emit.

A short crawler against next start in CI catches all of it before merge, which is the same instinct behind building a crawler that thinks like Googlebot. The point is not a score. It is knowing precisely what a crawler sees.

Single sources of truth

Technical SEO on a Next.js site is mostly that, and very little else. One host constant, one metadata helper, one generated sitemap, one entity graph.

Nearly every bug on this list is a version of two places disagreeing about the same fact. The canonical and the server. The sitemap and the routes. The JSON-LD and the page.

Remove the duplication and most of the checklist holds itself up. Then put the checks in CI so it stays that way without anyone remembering to care.

Frequently asked

What is the most common technical SEO mistake in Next.js?

A canonical URL that does not match the host actually being served. If the site is served from www and the canonical tag points at the apex domain, which then redirects back to www, Google receives contradictory signals about which URL to index. Derive every absolute URL from one constant and set metadataBase from the same value.

Do I need a sitemap if my Next.js site is small?

Yes, and in Next.js it costs almost nothing. A sitemap.ts file generates the sitemap from the same source your pages come from, so it stays accurate as posts are added. The benefit is not discovery on a small site, it is the lastmod date, which tells Google when a page actually changed rather than leaving it to guess.

Should tag or category pages be indexed?

Usually not. Tag archives are generated from other pages and rarely say anything a search result needs. Mark them noindex, follow so crawlers still traverse the links to your real content, and leave them out of the sitemap. Index them only when a tag page has genuine standalone content, such as an introduction and curation.

Does Next.js handle structured data automatically?

No. The Metadata API covers title, description, canonical, Open Graph and Twitter tags, but JSON-LD you add yourself, normally with a script tag rendered in the page. The practical approach is one graph per page that references shared nodes by @id, so the author entity is defined once and every article points at it.

Found this useful?Share on XShare on LinkedIn

Related reading