[]previous and next page

Not-found and error pages: their own metadata

A not-found UI (notFound) and an error UI (error) keep their status.

For agentsUpdated

A not-found UI (notFound) and an error UI (error) keep their status. Their metadata is their own: the module that owns the UI exports notFoundMetadata or errorMetadata (a static object, or a function with the generateMetadata signature). It is merged over the chain of the route that renders it, so a title takes the layout's template (Not found · Site) and a field the UI does not set is inherited.

ts
export const notFoundMetadata = { title: "Not found", robots: { index: false } };
  • A 404 is answered by the not-found UI of the route that renders it: the root layout's for an unknown URL. The browser merges the same metadata when that UI is on screen (a client navigation to an unknown path).
  • An error status is answered by the innermost route that has an error UI (a loader or beforeLoad failure). An error caught inside a component has no route, so it gets the chain's metadata only.
  • The built-in 404 (no not-found UI answers) has the title Not found and noindex. Configure it with createHandler({ notFoundPage: { title, noindex } }), or keep the status title (404 Not Found) and no robots tag with notFoundPage: false.