Next.js Discord

Discord Forum

What is the difference between the metadata constant, and the generateMetadata function?

Answered
Cimarrón Uruguayo posted this in #help-forum
Open in Discord
Avatar
Cimarrón UruguayoOP
^^
Image
Answered by iyxan23
having a constant metadata is useful for pages that's static and doesn't change, e.g. the homepage.

when you have a page that is dynamic and could display different things, e.g. a page showing the details of a product, generateMetadata is used to fetch stuff and have it set the title n stuff
View full answer

9 Replies

Avatar
Cimarrón UruguayoOP
oh i guess generateMetadata is more flexible
Image
scrolled down a lil further
Avatar
@Cimarrón Uruguayo ^^
Avatar
having a constant metadata is useful for pages that's static and doesn't change, e.g. the homepage.

when you have a page that is dynamic and could display different things, e.g. a page showing the details of a product, generateMetadata is used to fetch stuff and have it set the title n stuff
Answer
Avatar
you beat me to it lol
Avatar
Cimarrón UruguayoOP
haha 😅
thank you for the explanantion
Avatar
👍
Avatar
Cimarrón UruguayoOP
reaffirms my understanding