Next.js · Middle · Question 30 of 75

What does generateMetadata do compared to a static metadata export?

Explanation

export async function generateMetadata({ params }) { const post = await getPost((await params).slug); return { title: post.title } }. It runs on the server. There's a separate sitemap.ts file for sitemaps, and Open Graph images can be generated via opengraph-image.tsx.

Further reading

Problem with a question

Next.js · Middle · question 30

Test yourself

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

Take this quiz