$ ls ./menu

© 2025 ESSA MAMDANI

cd ../blog
3 min read

Next.js SEO: The Complete Checklist to Boost Your Site Ranking

Audio version coming soon
Next.js SEO: The Complete Checklist to Boost Your Site Ranking
Verified by Essa Mamdani

Next.js offers unparalleled performance out of the box, but rendering speed alone doesn't guarantee top search engine rankings. Search engines need context, structure, and explicit directives to understand your application.

This complete technical SEO checklist for Next.js (App Router) bridges the gap between raw performance and maximum search visibility.

1. The Metadata API (Meta Tags)

Gone are the days of manually injecting <head> tags. Next.js 15+ leverages a powerful Metadata API. Use generateMetadata for dynamic routes and export static metadata objects for fixed pages.

typescript
1// app/layout.tsx or app/page.tsx
2import type { Metadata } from 'next';
3
4export const metadata: Metadata = {
5  title: 'Next.js SEO Optimization Guide',
6  description: 'The ultimate checklist for technical SEO in Next.js.',
7  openGraph: {
8    title: 'Next.js SEO Optimization Guide',
9    description: 'The ultimate checklist for technical SEO in Next.js.',
10    url: 'https://essamamdani.com',
11    siteName: 'Essa Mamdani',
12    images: [
13      {
14        url: 'https://essamamdani.com/og-image.png',
15        width: 1200,
16        height: 630,
17      },
18    ],
19    locale: 'en_US',
20    type: 'website',
21  },
22};

2. JSON-LD Schema (Structured Data)

Structured data speaks the native language of search engines. Implement JSON-LD to help Google generate rich snippets. In the App Router, inject this directly into your components.

typescript
1// app/blog/[slug]/page.tsx
2export default function BlogPost() {
3  const jsonLd = {
4    '@context': 'https://schema.org',
5    '@type': 'Article',
6    headline: 'Next.js SEO Guide',
7    author: {
8      '@type': 'Person',
9      name: 'Essa Mamdani',
10    },
11    datePublished: new Date().toISOString(),
12  };
13
14  return (
15    <section>
16      <script
17        type="application/ld+json"
18        dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
19      />
20      {/* Post Content */}
21    </section>
22  );
23}

3. Dynamic Sitemaps (app/sitemap.ts)

A sitemap is the blueprint of your site for crawlers. The Next.js App Router allows you to programmatically generate sitemaps using a sitemap.ts file.

typescript
1// app/sitemap.ts
2import { MetadataRoute } from 'next';
3
4export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
5  const posts = await fetchPosts(); // Your DB call
6  
7  const blogUrls = posts.map((post) => ({
8    url: `https://essamamdani.com/blog/${post.slug}`,
9    lastModified: post.updatedAt,
10    changeFrequency: 'weekly',
11    priority: 0.8,
12  }));
13
14  return [
15    {
16      url: 'https://essamamdani.com',
17      lastModified: new Date(),
18      changeFrequency: 'yearly',
19      priority: 1,
20    },
21    ...blogUrls,
22  ];
23}

4. Robots Directives (app/robots.ts)

Protect your API routes and admin panels from being indexed while ensuring content pages are highly accessible.

typescript
1// app/robots.ts
2import { MetadataRoute } from 'next';
3
4export default function robots(): MetadataRoute.Robots {
5  return {
6    rules: {
7      userAgent: '*',
8      allow: '/',
9      disallow: ['/api/', '/admin/'],
10    },
11    sitemap: 'https://essamamdani.com/sitemap.xml',
12  };
13}

5. Canonical URLs & Link Tags

Duplicate content is a massive red flag. Always define canonical URLs via the Metadata API to consolidate your link equity.

typescript
1export const metadata: Metadata = {
2  alternates: {
3    canonical: 'https://essamamdani.com/blog/nextjs-seo-complete-checklist',
4  },
5};

6. Script Optimization (next/script)

Third-party scripts (analytics, ads, tracking) can decimate your performance metrics. Use next/script to defer execution and protect your Core Web Vitals.

typescript
1import Script from 'next/script';
2
3export default function RootLayout({ children }) {
4  return (
5    <html lang="en">
6      <body>
7        {children}
8        <Script 
9          src="https://www.googletagmanager.com/gtag/js?id=YOUR_ID" 
10          strategy="afterInteractive" 
11        />
12      </body>
13    </html>
14  );
15}

7. Image Optimization (next/image)

Images dictate your Largest Contentful Paint (LCP). next/image handles WebP/AVIF conversion, lazy loading, and responsive sizing automatically.

  • Always provide width and height to prevent layout shifts.
  • Use priority on above-the-fold images to improve LCP.
tsx
1import Image from 'next/image';
2
3export default function Hero() {
4  return (
5    <Image
6      src="/hero-cover.jpg"
7      alt="Next.js Optimization"
8      width={1200}
9      height={600}
10      priority // Critical for LCP
11      placeholder="blur"
12    />
13  );
14}

Final Protocol

Technical SEO in Next.js is not a one-time task; it is continuous engineering. Implement these fundamentals, monitor your Google Search Console, and keep your Core Web Vitals in the green.

If your site isn't ranking, your architecture might be blocking the crawlers. Fix it today.