Files
ffee09b6ff Move initial head (#45695)Co-authored-by: Jiachi Liu <[email protected]>
Move initial into the cache, so the top level boundaries will wrap the
head contents. Then we can use navigation API like `notFound` in the
`generateMetadata`, the notFound errors could be still captured in that
case

Closes NEXT-292

Added tests for not found in metadata

---------

Co-authored-by: Jiachi Liu <[email protected]>
2023-02-16 16:26:48 +01:00

20 lines
464 B
TypeScript

function format({ params, searchParams }) {
const { slug } = params
const { q } = searchParams
return `params - ${slug}${q ? ` query - ${q}` : ''}`
}
export default function page(props) {
return <p>{format(props)}</p>
}
export async function generateMetadata(props, parent) {
const parentMetadata = await parent
/* mutating */
return {
...parentMetadata,
title: format(props),
keywords: parentMetadata.keywords.concat(['child']),
}
}