Next.js › Metadata API & SEO Optimization
How do you set the page title and description for SEO in the Next.js App Router?
BeginnerAnswer
You export a metadata object from your page or layout file, defining fields like title and description, and Next.js automatically generates the correct HTML head tags for search engines and social media platforms to read when they crawl or share your page.
// app/about/page.js
export const metadata = {
title: 'About Us | My Company',
description: 'Learn more about our mission and team.'
};
export default function AboutPage() {
return <h1>About Us</h1>;
}Real-world example A company sets a clear, keyword rich title and description on its about page, helping it appear more attractively in search engine results when people search for the company by name.