Next.js · Junior · Question 14 of 75

How do you set a page's title and description in the App Router?

Explanation

The Metadata API works in server components: export const metadata = { title, description }, and for dynamic values export async function generateMetadata({ params }). Values from layout and page are merged. next/head is a Pages Router API.

Further reading

Problem with a question

Next.js · Junior · question 14

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz