⚡ Next.js Native

Built for Next.js
Zero Config SEO Integration

Native integration with Next.js App Router and Pages Router. Works seamlessly with SSR, SSG, and ISR rendering. Automatic sitemap generation, metadata API support, and TypeScript definitions. Install via npm and start automating—no configuration required.

4.2KB
Bundle Size (gzipped)
<2ms
Performance Impact
100%
TypeScript Coverage
187+ Next.js teams
Next.js 13, 14, 15
2.8M+
Pages Optimized
47K
Sites Using It
99.8%
Uptime
187+
Active Developers
🔀 Router Support

Works with Both Routers

Whether you're using the modern App Router or classic Pages Router, our library provides native integration with zero configuration. Switch between them seamlessly during migration.

📁

Next.js App Router Integration

File-based routing with layout.tsx and metadata API

Native Features Supported:

  • Metadata API: Export metadata objects from layout.tsx and page.tsx files with full type safety and IntelliSense
  • Server Components: SEO logic runs at build time with zero client-side JavaScript overhead
  • Route Handlers: API routes in app/api with automatic sitemap.xml and robots.txt generation
  • Dynamic Routes: Full support for [slug], [...slug], and [[...slug]] patterns with metadata
  • Parallel Routes: Works with @folder syntax and slot-based routing for complex layouts
  • Intercepting Routes: Metadata inheritance with (..) and (.) route interception patterns

Code Example:

// app/blog/[slug]/layout.tsx
import { Metadata } from 'next';
import { generateSEO } from '@seo-automation/nextjs';

type Props = {
  params: { slug: string }
}

export async function generateMetadata(
  { params }: Props
): Promise<Metadata> {
  const post = await fetchPost(params.slug);
  
  return generateSEO({
    title: post.title,
    description: post.excerpt,
    canonical: `/blog/${params.slug}`,
    openGraph: {
      type: 'article',
      publishedTime: post.date,
      authors: [post.author],
    },
    structuredData: {
      '@type': 'BlogPosting',
      headline: post.title,
      datePublished: post.date,
      author: { '@type': 'Person', name: post.author }
    }
  });
}

export default function Layout({ children }) {
  return <>{children}</>;
}

The library automatically handles OpenGraph tags, Twitter Cards, JSON-LD structured data, and canonical URLs with zero additional configuration.

🔄 Rendering Support

All Rendering Methods Supported

SSR for dynamic pages, SSG for static content, ISR for the best of both worlds. The library automatically detects your rendering method and optimizes accordingly.

Server-Side Rendering (SSR)

Pages rendered on every request

Perfect for pages with frequently changing content or personalized data. The library generates SEO meta tags server-side on each request, ensuring search engines always see fresh, optimized HTML. Ideal for user dashboards, real-time data, and authentication-required pages.

Best For:

  • User-specific dashboards and profiles
  • Pages with real-time data (prices, inventory)
  • Authentication-required content
  • A/B testing and personalization

Performance:

Response Time~50-200ms
SEO ImpactExcellent
Caching StrategyCDN Edge
🤖 Automation

Automatic SEO Generation

The library handles sitemap generation, metadata optimization, structured data, and route discovery automatically. No manual configuration or maintenance required.

🗺️

Automatic Sitemap Generation

For App Router, create a sitemap.ts file that exports a default function. The library auto-discovers all routes by scanning your file system, respects dynamic routes like [slug], fetches data for static paths, and generates sitemap.xml at build time. Supports sitemap indexes for sites with 50,000+ URLs.

// app/sitemap.ts
import { generateSitemap } from '@seo-automation/nextjs';

export default async function sitemap() {
  return generateSitemap({
    baseUrl: 'https://example.com',
    routes: ['/', '/about', '/pricing'],
    dynamicRoutes: {
      '/blog': await getBlogSlugs(),
      '/products': await getProductIds(),
    },
    changefreq: 'daily',
    priority: 0.8
  });
}
  • Automatic route discovery via file system
  • Dynamic route support with data fetching
  • Sitemap index for 50K+ URLs
  • Image and video sitemap support
🏷️

Metadata API Integration

Seamless integration with Next.js 13+ Metadata API. Export metadata objects from layout.tsx or page.tsx files, and the library enhances them with automatic OpenGraph tags, Twitter Cards, canonical URLs, and JSON-LD structured data. Full TypeScript support with IntelliSense.

// app/layout.tsx
import type { Metadata } from 'next';

export const metadata: Metadata = {
  title: 'My SaaS Product',
  description: 'Best tool for...',
  // Library auto-generates:
  // - OpenGraph tags
  // - Twitter Cards
  // - Canonical URLs
  // - JSON-LD structured data
};
  • Native Metadata API enhancement
  • OpenGraph and Twitter Cards auto-generated
  • Canonical URL management
  • TypeScript autocomplete and validation
📋

robots.txt Generation

Automatically generates robots.txt with optimal crawl directives. For App Router, create a robots.ts file. The library includes sitemap location, respects environment-specific rules (dev vs production), and supports per-bot policies for Google, Bing, and other crawlers.

// app/robots.ts
import { generateRobots } from '@seo-automation/nextjs';

export default function robots() {
  return generateRobots({
    rules: [
      { userAgent: '*', allow: '/' },
      { userAgent: '*', disallow: '/admin' },
    ],
    sitemap: 'https://example.com/sitemap.xml',
  });
}
  • Environment-specific rules (dev/prod)
  • Per-bot policies (Google, Bing, etc.)
  • Automatic sitemap.xml reference
  • Crawl-delay and request-rate directives
🔗

Structured Data Automation

Generates JSON-LD structured data for rich search results. Supports Schema.org types: Organization, Product, Article, BlogPosting, FAQPage, BreadcrumbList, and more. The library validates schemas against Google's structured data guidelines and injects them into page head automatically.

// Automatically generates:
{
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  "name": "Your App",
  "applicationCategory": "BusinessApplication",
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.8",
    "reviewCount": "250"
  }
}
  • 15+ Schema.org types supported
  • Google Rich Results validation
  • Automatic injection into page head
  • Nested schema support (breadcrumbs, FAQs)
⚡ Performance

Minimal Performance Impact

Optimized for Next.js performance best practices. Small bundle size, tree-shaking support, and zero client-side overhead for server components.

4.2KB
Core Library (gzipped)

Tiny footprint with tree-shaking. Only import what you use. Most features run server-side with zero client JavaScript.

<2ms
Added Load Time

Independent benchmarks show negligible performance impact. SEO operations happen at build time or on server.

100%
Lighthouse Score

Maintains perfect Lighthouse performance scores. No render-blocking scripts or layout shifts introduced.

Technical Optimizations

Bundle Optimization:

  • Tree-shaking: Unused features automatically removed during build
  • Code splitting: Dynamic imports for optional features
  • ES modules: Modern module format for better compression
  • Zero dependencies: No external packages (only peer deps)

Runtime Optimization:

  • Server Components: SEO logic runs server-side (0KB client JS)
  • Build-time generation: Sitemaps and robots.txt created at build
  • Lazy loading: Client components load only when needed
  • Memoization: Cached computations for repeated operations
❓ FAQ

Frequently Asked Questions

Does this work with both Next.js App Router and Pages Router?

Yes, fully compatible with both architectures. For App Router (Next.js 13+), we integrate with the native Metadata API, layout.tsx files, and server components. For Pages Router, we provide Head components, getStaticProps/getServerSideProps helpers, and _document.js integration. You can even use both routers in the same project during migration—the library detects which router each route uses automatically. All features work identically across both architectures with the same API.

What rendering methods are supported?

All Next.js rendering methods: Server-Side Rendering (SSR) for dynamic pages with getServerSideProps or Server Components, Static Site Generation (SSG) with getStaticProps and getStaticPaths for maximum performance, Incremental Static Regeneration (ISR) with revalidate timestamps for hybrid static/dynamic pages, and Client-Side Rendering (CSR) with useEffect hooks for authenticated content. The library automatically detects your rendering method and optimizes SEO accordingly—no manual configuration needed.

How does the sitemap generation work with Next.js?

For App Router, create a sitemap.ts file in your app directory that exports a default function returning URL arrays. The library auto-discovers all routes via file system scanning, respects dynamic routes like [slug], fetches data for getStaticPaths equivalents, and generates sitemap.xml at build time. Supports sitemap indexes for 50,000+ URLs automatically. For Pages Router, use our generateSitemap helper in a custom API route at pages/api/sitemap.xml.ts. Both methods support image sitemaps, video sitemaps, and news sitemaps.

Is there any performance impact on my Next.js app?

Minimal impact: core library adds only 4.2KB gzipped to your bundle. Tree-shaking removes unused features automatically. Server components handle SEO logic at build time (zero client bundle). Client components are lazy-loaded on demand. Sitemap generation happens at build time, not runtime. Metadata operations use Next.js native APIs (no overhead). Independent benchmarks show <2ms added to page load times. The library maintains 100/100 Lighthouse performance scores with no render-blocking scripts or layout shifts.

Can I use this with TypeScript?

Absolutely. The library is written in TypeScript with full type definitions included. You get IntelliSense autocomplete for all functions, type checking for metadata objects (prevents typos and incorrect values), compile-time error detection before deploying, and generic types for custom configurations. Works seamlessly with Next.js's built-in TypeScript support. All examples in our documentation use TypeScript. The type definitions cover Metadata API, sitemap interfaces, structured data schemas, and all configuration options.

Do I need to modify my next.config.js file?

No configuration needed in most cases. The library uses Next.js conventions and doesn't require webpack customization, middleware setup, or custom server configuration. For advanced features like custom sitemap locations, internationalization (i18n), or multi-domain setups, optional config is available but not required. True zero-config for 95% of use cases—just npm install, add your API key to .env.local, and import. The library works out of the box with Vercel, Netlify, AWS Amplify, and any Node.js hosting platform.

Start Optimizing Your Next.js Site Today

Join 187+ development teams using our native Next.js SEO library. Zero configuration, full TypeScript support, and <2ms performance impact.

✓ No credit card required
✓ 14-day free trial
✓ Cancel anytime