Question · Vibe coding with Claude Code course · Module 12: Medium clone

generateMetadata or metadata

The browser tab on the /articles/[id] page should show the title of the specific article. What do you use in page.tsx?

Answer options

  • export const metadata with the title "Article", because it is simpler
  • generateMetadata, which gets params, reads the article and returns its title and description
  • metadata in app/layout.tsx with a list of the titles of all articles
  • Both at once in the same page.tsx: metadata as a fallback, generateMetadata for the article

You can check the correct answer by solving this task in the CodeWorlds game.