Back to Blogs

Technical SEO in Next.js

Learn how to improve technical SEO in Next.js using metadata, canonical URLs, structured data, sitemaps, and search engine optimization best practices.

Technical SEO in Next.js featuring metadata, canonical URLs, JSON-LD structured data, and search rankings.

Technical SEO in Next.js

Building a website is only one part of creating a successful online presence. Search engines also need to understand the content, structure, and purpose of each page.

Next.js provides several features that help developers implement technical SEO more effectively. By combining metadata, canonical URLs, structured data, and a well-organised site structure, developers can make websites easier for search engines to discover and understand.

1. Manage Page Metadata

Metadata helps search engines and users understand what a page contains. Important elements include the page title, meta description, canonical URL, and social sharing information.

In the Next.js App Router, metadata can be defined using the Metadata API.

import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Technical SEO in Next.js",
  description:
    "Learn Next.js SEO fundamentals, including metadata, canonical URLs, and structured data.",
};

For pages with dynamic content, metadata can also be generated using generateMetadata().

Write unique titles and descriptions that accurately reflect each page. Avoid duplicating metadata across unrelated pages.

2. Use Canonical URLs

Canonical URLs help search engines identify the preferred URL when the same or substantially similar content is accessible through multiple URLs.

For example, if a page can be accessed using different query parameters, you may want to specify its preferred URL.

import type { Metadata } from "next";

export const metadata: Metadata = {
  alternates: {
    canonical: "https://example.com/blog/technical-seo-in-nextjs",
  },
};

Replace the example URL with the actual canonical URL of your page.

Ensure that canonical URLs use the correct domain, HTTPS, and preferred URL format. A canonical tag is a signal to search engines, not a guarantee that they will select that URL.

3. Add JSON-LD Structured Data

JSON-LD allows developers to describe a page using structured data based on supported Schema.org vocabulary.

For a blog article, the BlogPosting schema can describe the headline, description, publication date, author, and featured image.

const articleSchema = {
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  headline: "Technical SEO in Next.js",
  description:
    "Learn how to implement technical SEO in Next.js.",
  datePublished: "2026-10-21",
  author: {
    "@type": "Person",
    name: "Vishal Patel",
  },
};

In a production page, render the schema as JSON-LD in the document and include accurate values for the article's canonical URL, publication date, image, and other relevant properties.

Structured data helps search engines interpret content and may make a page eligible for certain search enhancements. It does not guarantee rich results or higher rankings.

4. Create a Sitemap

A sitemap helps search engines discover important URLs on your website.

Next.js supports generating a sitemap through app/sitemap.ts.

import type { MetadataRoute } from "next";

export default function sitemap(): MetadataRoute.Sitemap {
  return [
    {
      url: "https://example.com/",
      lastModified: new Date(),
    },
    {
      url: "https://example.com/blog",
      lastModified: new Date(),
    },
    {
      url: "https://example.com/blog/technical-seo-in-nextjs",
      lastModified: new Date(),
    },
  ];
}

Replace example.com with your website's domain and use accurate modification dates. Include canonical, indexable pages rather than URLs that redirect or should not be indexed.

5. Optimise Your Website Structure

Technical SEO also depends on how pages connect to each other and how efficiently users can access content.

Consider these practices:

  • Use descriptive URLs and clear page headings.
  • Add meaningful internal links between related articles.
  • Optimise images and provide useful alternative text.
  • Maintain responsive layouts for mobile devices.
  • Avoid broken links and unnecessary redirect chains.
  • Check page performance and Core Web Vitals.

These improvements support a better user experience and help search engines crawl and understand your website.

6. Validate Your SEO Implementation

After implementing SEO features, check that they work as intended.

Useful tools include:

  • Google Search Console for indexing and search performance.
  • Google Rich Results Test for supported structured data.
  • Schema.org Validator for schema syntax and structure.
  • Lighthouse for performance and accessibility checks.

Remember that passing a validation test does not guarantee indexing or rankings. Search engines consider many other factors when evaluating pages.

Conclusion

Next.js provides a strong foundation for technical SEO, but the framework alone does not guarantee search visibility.

Effective implementation requires accurate metadata, appropriate canonical URLs, valid structured data, discoverable pages, and a good user experience.

By making these elements part of the development process, developers can build websites that are easier to maintain and better prepared for search engine discovery.

Back to Home