Next.js Discord

Discord Forum

Server component get current url

Answered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
For Metadata, OG, JSON-LD, is there a solid way to get the current url of the page?
Answered by Rafael Almeida
you can get the params and search params using generateMetadata: https://nextjs.org/docs/app/building-your-application/optimizing/metadata#dynamic-metadata
I don't think you can get the actual path but you don't really need it as you are already defining the function in a specific page file
View full answer

3 Replies

you can get the params and search params using generateMetadata: https://nextjs.org/docs/app/building-your-application/optimizing/metadata#dynamic-metadata
I don't think you can get the actual path but you don't really need it as you are already defining the function in a specific page file
Answer