Skip to content
SeoWiki

The SEO encyclopedia

Technical SEO

Next.js SEO

Next.js SEO is the practice of configuring a Next.js site so search engines can crawl, render, index, and understand its pages efficiently.

Beginner3 min readUpdated 2026-07-26Reviewed by Lucía Marín

Key takeaways

  • Next.js can deliver fully rendered HTML to search engines, improving indexability over client-side-only frameworks.
  • Use the Metadata API for per-page SEO control (title, description, canonical).
  • Always generate a sitemap and configure robots.txt to guide crawlers.
  • Avoid blocking important pages or relying on client-side rendering for critical content.
  • Implement structured data and hreflang for richer search results and international targeting.

Next.js offers server-side rendering and static generation, which can give SEO advantages when combined with solid Technical SEO practices.

Example: Adding metadata to a product page

Consider a Next.js e-commerce site with a product page at /product/123. Using the Metadata API, you can set the page title, description, and canonical URL:

import { Metadata } from 'next';

export const metadata: Metadata = {
  title: 'Blue Running Shoes | MyStore',
  description: 'Lightweight blue running shoes with breathable mesh. Free shipping.',
  canonical: 'https://example.com/product/123',
};

This ensures search engines see a unique title and description for each product, reducing duplicate content issues. Additionally, you can generate a sitemap that includes all product URLs and submit it via Search Console.

Quick-start: Basic SEO setup in Next.js

  1. Install Next.js – Create a new project using npx create-next-app@latest.
  2. Add metadata – Use the Metadata export in each page or layout to set title, description, and canonical.
  3. Generate a sitemap – Use the built-in sitemap.ts file or the next-sitemap package to create an XML sitemap.
  4. Configure robots.txt – Place a robots.txt file in the public folder to allow or disallow crawler access.
  5. Add structured data – Embed JSON-LD in your pages using a <script> tag or a component. Consider using Schema markup for better rich results.
  6. Set up hreflang – For multilingual sites, use the alternate metadata property or a custom header.

Prerequisites

  • A working Next.js project (version 13+ recommended for the Metadata API).
  • Basic understanding of SEO concepts (crawling, indexing, metadata).
  • Access to Google Search Console to monitor indexing.
  • Familiarity with your site’s URL structure and content hierarchy.

Common mistakes

  • Client-side rendering for key content – If you rely on useEffect or client-side data fetching for important text, search engines may not see it. Use server components or static generation.
  • Blocking pages with robots.txt – Accidentally disallowing important paths can prevent indexing. Test your robots.txt in Search Console.
  • Missing canonical tags – Duplicate URLs (e.g., with query parameters) should have a canonical tag pointing to the preferred version.
  • No sitemap or incomplete sitemap – Without a sitemap, search engines may miss pages, especially in large or dynamic sites.

Next step

FAQ

Is Next.js good for SEO?

Yes, Next.js provides server-side rendering and static generation, which deliver fully rendered HTML to search engines, making it easier for them to index content compared to client-side-only frameworks.

Do I need a sitemap for Next.js?

Yes, a sitemap helps search engines discover all important pages, especially for large or dynamic sites. Next.js offers built-in sitemap generation or you can use next-sitemap.

Related topics

Sources

Reviewed by Lucía Marín, Founding editor.