Next.js Discord

Discord Forum

How to get the client's cookie and use it in generateMetadata?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Avatar
Transvaal lionOP
help

1 Reply

Avatar
not-milo.tsx
To access cookies inside the generateMetadata function use the cookies function exported from next/headers. Keep in mind that this will opt your page out of static rendering and render it dynamically on request, which means you'll see slower load times for that page.