Next.js SEO guide
SEO for Next.js: what to set up and what breaks
Next.js can produce very crawlable pages, but only if each route is rendered, tagged and linked on purpose. This guide covers the setup and the mistakes we look for first.
In short
Next.js is good for SEO when important content is in the server-rendered HTML, each page has its own title, description and canonical, and a sitemap lists only indexable URLs. Choose static or incremental rendering for pages that rarely change, server rendering for personalized ones, and keep client-side fetching away from anything you want ranked.
Start with the rendering mode, not the plugin list
Search engines can run JavaScript, but they do it in a second pass that can lag behind the first crawl. Content that exists in the HTML response is seen at once. Content that appears only after a browser fetch may be seen late, or in a thin form. In Next.js the choice is made per route, so make it deliberately.
| Page type | Rendering mode | Why |
|---|---|---|
| Marketing pages, about, pricing | Static generation | Fastest to serve and fully visible in the first response |
| Blog, docs, product pages that change weekly | Static with revalidation (ISR) | Stays fast and picks up edits without a full rebuild |
| Search results, filtered lists | Server rendering or noindex | Output depends on the request, so decide if it should rank at all |
| Account, cart, dashboards | Client or server, always noindex | Private pages have no search value |
A quick test: open the page, use view-source, and search for the sentence you want to rank for. If it is not there, it depends on JavaScript, and that is the first thing to fix.
Set up the pieces that every route needs
- Metadata per routeUse the Metadata API in the App Router: a static metadata export for fixed pages, generateMetadata for dynamic ones. Every route gets a unique title, a description written for a click, and an Open Graph image.
- Self-referencing canonicalSet alternates.canonical on each page to the clean, final URL. This stops tracking parameters, preview domains and trailing-slash variants from competing with the real page.
- One URL formatDecide on trailing slash or none in next.config and keep it. Add redirects there for old paths, using permanent redirects for pages that moved for good.
- Sitemap and robotsGenerate sitemap.xml and robots.txt from the app itself so they never drift from the routes. Include only URLs that return 200 and are meant to be indexed.
- Structured dataAdd JSON-LD in the page component for Organization, Article, Product or FAQ where the content really matches. Validate it before release.
- Images and fontsUse the Image component with real alt text and set width and height to prevent layout shift. Load fonts through the built-in font loader to avoid late swaps.
A worked example: one product route
Take an online store with a dynamic route at /products/[slug]. This is an illustration of the method, not client data. The route should pre-build its most visited products with generateStaticParams, then serve the rest on demand and revalidate every few hours.
- generateMetadata reads the product and returns a title such as the product name plus category, a description from the first useful sentence, and the canonical.
- The page component renders price, availability and description on the server, so they are in the HTML.
- Product JSON-LD is built from the same data object as the visible text, so the two cannot disagree.
- If the slug does not exist, the route calls notFound() so the response is a real 404, not a blank page with a 200.
- Variant selectors such as size or color change the page with client code, but each variant that needs to rank gets its own crawlable link or its own URL.
The same pattern works for service areas, locations and article archives. If you are weighing Next.js against a CMS-first build, the Next.js vs WordPress comparison sets out the trade-offs.
Pitfalls we see on Next.js sites
- Content fetched in useEffect or behind a click, which is missing from the server HTML.
- Soft 404s: a custom not-found view that still returns status 200. Check with a header request, not with your eyes.
- Preview and staging deployments that are indexable. Block them with authentication or a noindex header, and confirm it.
- Redirect chains created by middleware plus config redirects plus a trailing-slash rule, sometimes three hops long.
- Infinite scroll with no paginated URLs, so deep items have no link a crawler can follow.
- Locale routes without hreflang, or with hreflang that points to redirected URLs.
- Heavy client bundles from third-party scripts that push Interaction to Next Paint up on mobile.
- A single global title template that makes every page title identical after the first word.
Shipping a rebuild? Crawl the old site before launch and map every old URL to its new one. Most ranking loss after a Next.js migration comes from missed redirects, not from the framework.
How to check your work
- Fetch the raw HTMLUse a header and body request, or view-source, and confirm the title, canonical, headings and main text are present.
- Inspect in Search ConsoleRun URL Inspection on a sample of each template, then open the crawled HTML and the rendered screenshot.
- Test structured dataPaste the URL into Google's Rich Results Test and fix errors before warnings.
- Watch Core Web VitalsCompare lab results with the field data in Search Console, since real devices differ from your laptop.
- Monitor after releaseCheck Pages indexing weekly for the first month and look at newly excluded URLs.
If you want an outside review, a technical SEO audit covers rendering, redirects, crawl paths and speed for a Next.js site. You get a fixed quote after a short call through the contact page.
Updated 30 October 2026
Questions, answered
Is Next.js good for SEO?
Should I use the App Router or the Pages Router for SEO?
Does Google index client-side rendered React content?
How do I stop staging and preview URLs being indexed?
Do I need next-seo or a similar package?
Keep exploring
Next.js and headless development, only where it pays off
A headless build separates your content from the website that shows it. That is powerful and costs more to run, so we start by checking whether you…
ServiceTechnical SEO services for sites that will not index
If good pages are missing from Google, or rankings fell after a rebuild, the cause is usually technical. We find it in your Search Console and fix it…
ChecklistTechnical SEO checklist
Most technical SEO lists treat every item as equal. This one sorts checks into four levels, from problems that remove pages from Google to polish…
Want a Next.js site reviewed for search?
Tell us the stack and the pages that matter, and we will send a fixed quote after a short call.