mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
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]>
20 lines
464 B
TypeScript
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']),
|
|
}
|
|
}
|