[]previous and next page

How layers merge

The chain is walked outermost first: the root layout, each layout, then the page.

For agentsUpdated

The chain is walked outermost first: the root layout, each layout, then the page. Each layer is merged onto what the layers above resolved, with these rules (merge.ts):

  • Titles. A string title is wrapped in the nearest template above it; %s is replaced. absolute sets the title and skips the template. default is used only when no layer sets a title. template: null clears the inherited template for the layers below.
  • Every other field replaces the value above it, as a whole. A page's openGraph replaces the layout's openGraph; the fields are not merged one by one. The exception is other, whose keys merge.
  • null removes the value above it.
  • metadataBase replaces the base above it. It is parsed once, after the merge, and must be an absolute http(s) URL; anything else fails the render with a TypeError.
  • generateMetadata receives the merged result of the layers above as parent. Its title is the string the page shows, so a page can extend it.