Next.js Discord

Discord Forum

Differents canonicalUrl in the same page?

Unanswered
Bonga shad posted this in #help-forum
Open in Discord
Bonga shadOP
Hello guys.

I have this route: /quotation/new that should redirect users to the content of /quotation/landingsem. However, in my page, I want to include a canonical URL in the generateMetadata function that reflects the entry point. If a user accesses the page from https://localhost:3000/quotation/landingsem, the canonical URL should include that, and if they access from https://localhost:3000/quotation/new, the canonical URL should include that URL instead.

In other words, the rendered page will be the same, but I want the canonical URL to vary based on the URL from which the page is accessed..

I don’t know how can I do that in a Server component using App Router.

1 Reply

Bonga shadOP
Up??