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.
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.
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:
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)
Minimal Performance Impact
Optimized for Next.js performance best practices. Small bundle size, tree-shaking support, and zero client-side overhead for server components.
Tiny footprint with tree-shaking. Only import what you use. Most features run server-side with zero client JavaScript.
Independent benchmarks show negligible performance impact. SEO operations happen at build time or on server.
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