Next.js SEO
Next.js server-renders by default, so the usual SEO failures are configuration rather than rendering: a missing metadataBase that breaks canonical and share URLs, no sitemap.ts, and not-found pages that stream with status 200. Scan the deployed site to see which of these yours has.
Where SEO lives in an App Router project
Titles, descriptions, canonical links and Open Graph tags come from the Metadata API: a metadata export or a generateMetadata function in a layout or page. Child segments override parents, so a title set once in the root layout ends up on every page that doesn’t set its own. Relative URLs in metadata resolve against metadataBase; leave it unset and canonical and image URLs come out wrong or missing.
app/sitemap.ts and app/robots.ts generate the two files from code, which keeps them in step with your routes. opengraph-image.tsx makes a share image per segment.
Streaming is the subtle one. A streamed response starts with status 200 and the status is fixed once streaming starts. If notFound() runs after that, Next.js streams the 404 page with a noindex robots tag, so search engines leave the URL out, but the status stays 200 and some crawlers report it as a soft 404. To return a real 404, the check has to run before streaming starts, for example in Proxy.
Common causes, and the fix for each
The root layout’s title on every page
Fecto check index.meta-tags · Title and description
The check wants a title, description and canonical per page. In Next.js the fix is usually a generateMetadata in each dynamic route and alternates.canonical set to the page’s own path, with metadataBase set once in the root layout.
No sitemap, or one that lists half the routes
Fecto check index.sitemap · A sitemap exists
Dynamic routes don’t appear in a sitemap unless sitemap.ts reads the same data the pages do. Your agent generates the list from that source, not by hand.
Missing pages that answer 200
Fecto check index.soft-404 · Missing pages return 404
Fecto requests a URL that can’t exist and wants a 404 or 410. A loading.tsx above a dynamic route starts streaming before the page decides the slug is unknown, so the 404 arrives with status 200. Moving the existence check earlier, or out of the streamed segment, fixes it.
No robots.txt
Fecto check access.no-robots-txt · robots.txt exists
Not a block, since no file means everything is allowed, but robots.ts is also where the sitemap gets declared. It is a short file and an easy first pull request.
Client components that fetch their own text
Fecto check read.main-text-needs-js · Main text is in the HTML
Server rendering only helps if the text is in the server render. A "use client" component that loads its copy in useEffect ships an empty shell for that block. Moving the fetch into a server component puts the text back in the HTML.
Let your agent do it
Any of the agents below can do this. They read your app/ folder, add or fix the metadata exports, sitemap.ts and robots.ts in separate pull requests, and run each step’s checks against next dev before reporting, so a broken canonical never reaches review.
No coding agent yet? Install the Claude app, sign in, then come back and choose Claude app.
Set it up by hand
curl -fsSL https://fecto.ai/install | shThen tell it
Use Fecto to check and fix my site.Don’t add next-seo to an App Router project
The Metadata API covers what that package did for the Pages Router. Two systems writing the same tags is how you end up with two canonicals.
What it costs
You pay only when the result shows up on your site: +20% more visits or enquiries is $30, +50% is $60, double is $100, and anything below +20% costs $0. Never more than $100 a site a month.
Questions
Which Next.js SEO best practices matter most?
Start with what can stop a page being read or indexed: text in the server render, no stray noindex, every public route in the sitemap. Then the hygiene that shapes how it shows: its own title, description and canonical, real 404s, share tags. Structured data last.
Pages Router or App Router: does it matter for SEO?
Both server-render. The difference is where tags come from: next/head in the Pages Router, the Metadata API in the App Router. Mixing the two during a migration is a common way to end up with two titles or two canonicals, so the agent checks the served HTML, not the source.
Do I need generateStaticParams for SEO?
Not for indexing: a dynamic route renders on request and crawlers get the same HTML. It makes pages faster and the list of pages explicit, which is handy because the sitemap needs the same list.
How do I set meta tags on a page that is a client component?
A file marked "use client" can’t export metadata. Keep the page file a server component that exports metadata or generateMetadata, and render the client component inside it.
Related guides
Checked against Next.js docs: loading.js, streaming and status codes on 18 November 2026.