mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What Exclude the cases like external urls and relative urls with query from appending trailing slash when it's needed. The process is: - If it's a uncertain string path (relative url, could start with `'./'` or `/`), convert to relative that starts with `/`; - then we covert the url (string or URL) to string url - We do the check if we need to append the trailing slash ### Why In #62109 we added functionality that can only append trailing slash when we appended trailing slash to some metadata url like `canonical` url and open graph url when the config is enabled. For urls with queries, the trailing slash can also be omitted. For the external urls (different origin comparing to `metadataBase`) we don't need to append trailing slash as they're not the same web app. x-ref: [slack thread](https://vercel.slack.com/archives/C0676QZBWKS/p1709845946033929) Closes NEXT-2762 Closes NEXT-2753
15 lines
296 B
JavaScript
15 lines
296 B
JavaScript
export default function Page() {
|
|
return 'page'
|
|
}
|
|
|
|
export const metadata = {
|
|
openGraph: {
|
|
// external url with different domain
|
|
url: 'http://trailingslash-another.com/metadata',
|
|
},
|
|
alternates: {
|
|
// relative url with query string
|
|
canonical: '/metadata?query=string',
|
|
},
|
|
}
|