[]previous and next page

Output parity with Next.js 16

The head is written in the order Next.js 16 writes it for the same input: the viewport block, then the title, the description, the application name, the authors (the…

For agentsUpdated

The head is written in the order Next.js 16 writes it for the same input: the viewport block, then the title, the description, the application name, the authors (the link before the meta), the manifest, the generator, the keywords, the referrer, the creator, the publisher, the robots and googlebot, the rel lists, the alternates, the platform tags, the verification, the Apple web app, Open Graph, Twitter, the app links and the icons last. These rules follow Next's own source (resolve-opengraph.js, resolve-metadata.js, resolve-basics.js, metadata.js):

  • og:type is written only when openGraph.type is set.
  • og:title and og:description fall back to the page's title and description only when an openGraph object exists.
  • A Twitter block inherits the page's title and description, and the Open Graph title, description and images, for what it does not set. A page with Open Graph and no Twitter block gets one. The card is summary_large_image with an image and summary without.
  • Robots: index or noindex, follow or nofollow, then the other directives in Next's order (max-image-preview before max-snippet), joined with , . A value is name:value with no space (unavailable_after:2030-01-01).
  • Keywords are joined with a bare comma (a,b).
  • Icons and the manifest are written as given: a relative address stays relative. metadataBase applies to the canonical, Open Graph and Twitter URLs.
  • A canonical, an alternate or og:url value of ./ is the page's own path, so a root layout's canonical: "./" gives each page its address (/sign-in gets https://example.com/sign-in). The page's pathname comes from the request (or the client's location); resolveChain takes it as context.pathname.
  • With metadataBase set, a root URL (/, no query) is written as the bare origin, without its slash (Next's resolveAbsoluteUrlWithPathname): the home canonical is https://example.com. Without a base a relative value is written as the path.