← Next.js learning pathNext.js · Module 7 of 10
SEO and metadata
Give each page titles, descriptions, social cards and sitemaps.
📖 Key ideas
- Export metadata = { title, description } from a page or layout.
- generateMetadata creates metadata for dynamic pages.
- Add Open Graph images for social sharing.
- app/sitemap.ts and app/robots.ts generate SEO files.
- Use semantic HTML and one h1 per page.
💡 Real-life example: Metadata is the label on a jar: search engines read it before opening.
metadataExported object for title and description
generateMetadataAsync metadata for dynamic routes
Open GraphTags for social previews
sitemap.tsGenerates sitemap.xml