Next.js Discord

Discord Forum

dynamic Canonical tag

Answered
Clapper Rail posted this in #help-forum
Open in Discord
Clapper RailOP
can someone help to to figure it out how i can add dynamically add Canonical tag in nextjs app router

i have different different URL and domain in some page i want to show diff url with domain so how can i achive this task #help-forum
Answered by B33fb0n3
you can use the [genearteMetadata function](https://nextjs.org/docs/app/api-reference/functions/generate-metadata) that will get the params from the page as well and like that you can tell the server which page (and on what kind of params) the page should have which canonical url
View full answer

1 Reply

@Clapper Rail can someone help to to figure it out how i can add dynamically add Canonical tag in nextjs app router i have different different URL and domain in some page i want to show diff url with domain so how can i achive this task <#1007476603422527558>
you can use the [genearteMetadata function](https://nextjs.org/docs/app/api-reference/functions/generate-metadata) that will get the params from the page as well and like that you can tell the server which page (and on what kind of params) the page should have which canonical url
Answer