App Router & RSC · 9 min read · Intermediate
Dynamic Routes, Static Params & SEO Metadata
Create dynamic [slug] pages, pre-render static paths with generateStaticParams, and generate per-page OpenGraph metadata.
What you'll learn
- Read dynamic params in async page components
- Pre-build static pages at build time with generateStaticParams
- Generate dynamic title, description, and OG tags with generateMetadata
Overview
Create dynamic [slug] pages, pre-render static paths with generateStaticParams, and generate per-page OpenGraph metadata.
Next.js App Router unifies server rendering, streaming, type-safe mutations, and edge-ready caching inside a single React + TypeScript codebase.
Production Code Example
// app/courses/[slug]/page.tsx
import type { Metadata } from 'next';
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const { slug } = await params;
return { title: `${slug} | DevPath` };
}
Key Takeaways
- Read dynamic params in async page components
- Pre-build static pages at build time with generateStaticParams
- Generate dynamic title, description, and OG tags with generateMetadata
Quick Check
Check Your Understanding
Score: 0 / 1
1. What does exporting `generateStaticParams()` from a dynamic `[slug]/page.tsx` route enable?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.