Nextjs 14: Not able to add url with trailing slash in meta details like canonical url and og:url #65323
Replies: 3 comments 2 replies
-
|
I encountered the same issue🥲 |
Beta Was this translation helpful? Give feedback.
-
|
bro same |
Beta Was this translation helpful? Give feedback.
-
|
This behavior is actually expected after the migration from Next.js 13 → 14. Starting with Next 14, If you explicitly want to preserve the trailing slash, you can define them via the export async function generateMetadata() {
const url = 'https://nextjs.org/';
return {
alternates: { canonical: url },
openGraph: { url },
};
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I just migrated v13 to v14. After migrations the canonical url and og:url in metadata of the pages donot have trailing slash when I have explicitly added that. Its an issue cause the crawler will take it as different url from the previous one.
Additional information
No response
Example
<link rel="canonical" href="https://nextjs.org"><meta property="og:url" content="https://nextjs.org">No response
Beta Was this translation helpful? Give feedback.
All reactions