Files
Jiachi LiuandGitHub 488984cc03 fix: default relative canonical url should not contain search (#63843)
### What

Strip the search query for the `urlPathname` passed down to metadata
handling.

### Why
This is because the `urlPathname` from `staticGenerationStore` contains
query, so it will contain `?rsc` query for client navigation, which lead
to the relative path canonical url (e.g. `./`) will have the search
query along with it. This PR is to remove that and make sure always uses
pathname.

Reported by @pacocoursey 

Closes NEXT-2963
2024-03-28 23:16:22 +00:00

24 lines
557 B
TypeScript

export default function Page() {
return <p id="alternates">alternate</p>
}
export async function generateMetadata(props, parentResolvingMetadata) {
const parentMetadata = await parentResolvingMetadata
return {
...parentMetadata,
alternates: {
...parentMetadata.alternates,
media: {
'only screen and (max-width: 600px)': '/mobile',
},
types: {
'application/rss+xml': [
{ url: '/blog.rss', title: 'rss' },
{ url: '/blog/js.rss', title: 'js title' },
],
},
},
}
}