Complete metadata references and fix descriptor resolution (#101547)
## Summary
Complete the public `Metadata` and `Viewport` field references so
supported options can be found without inspecting framework types. Both
static exports and the `generateMetadata` / `generateViewport` functions
use these shapes.
Updated references:
- `generate-metadata`: keep examples and compact input tables for all
Open Graph variants and descriptors, Twitter cards and player
configuration, and crawler/application/link fields. Focus explanations
on Next.js URL resolution, inheritance, accepted input forms, and
defaults; link to underlying standards for property meanings instead of
repeating every tag mapping. Clarify discouraged/deprecated options,
custom tag merging, and Facebook's existing support for supplying both
identifiers.
- `generate-viewport`: document every layout field and its accepted
values, including `viewportFit`, and explain retained defaults and
explicit `undefined`.
The audit also found two resolver inconsistencies that prevented
documented input forms from working. Normalize scalar `songs` for music
albums/playlists and scalar playlist `creators`, and preserve `title` on
canonical-link descriptors. Add resolver and end-to-end regression
coverage, and remove the stale viewport type comment claiming
`userScalable` is omitted. The fixes and documentation expansion are
separate commits in this PR.
For example, `alternates.canonical: { url: "/article", title: "Article"
}` previously lost `title` while resolving the URL, even though the
input type permits it and the renderer already handles the attribute.
The fix retains it on the generated canonical link.
Add a real-app fixture suite covering all 34 Metadata fields (including
the ignored deprecated viewport fields), all 10 Viewport fields, all 12
Open Graph types, and all four Twitter cards. The suite checks emitted
tags and attributes for scalar/array inputs and nested descriptors, plus
static exports, inherited values, title templates, custom-tag merging,
and defaults. Correct the Pinterest output example to match the emitted
`property` attribute.
The references link to the Open Graph protocol, HTML metadata names,
Google's crawler directives, Apple's web app/Smart App Banner docs, and
the viewport reference for the underlying meanings and constraints.
Existing section anchors are preserved.
Related findings: [viewport reference omission
(7135)](https://next-maintainer-agent.vercel.tools/agent-feedback/7135),
[metadata reference follow-up
(7228)](https://next-maintainer-agent.vercel.tools/agent-feedback/7228).
## Verification
- Metadata resolver unit suites: 30 passed.
- `pnpm test-dev-turbo test/e2e/app-dir/metadata/metadata.test.ts`: 49
passed, one existing skip.
- `pnpm test-start-turbo test/e2e/app-dir/metadata/metadata.test.ts`: 51
passed.
- Metadata options fixtures: 80 passed in Turbopack development, 80
passed in Turbopack production, and 80 passed in Turbopack production
with Cache Components enabled. These validate generated HTML, not
downstream browser/crawler support.
- Rendered both updated pages in local `front`/next-site and checked the
tables. The content transform and URL checks pass.
- Core Next.js build, repository type check, test-library type check,
and changed-file Prettier/ESLint checks pass.
- Checked the field tables against public input types and
renderer/resolver behavior, verified same-page fragment links, and
refreshed the bundled docs.
- Full `pnpm lint` stops on ten existing unused Rust turbo-task items
outside this change.
- Full `pnpm build-all` is blocked locally because the selected stable
Rust compiler rejects the checkout's nightly flags. The core JavaScript
build and both end-to-end modes passed using the matching published
native binding.
<!-- NEXT_JS_LLM -->