Skip to content

Support static metadata URL resolver (fillStaticMetadataSegment) #861

@github-actions

Description

@github-actions

Context

7873aeaPerf: Simplify static metadata handling (Next.js canary, 2026-04-17)

Next.js added a dedicated fillStaticMetadataSegment() function in lib/metadata/get-metadata-route.ts that resolves static metadata file URLs without route-regex work. Static metadata files like favicon.ico, icon.png, and other static metadata images no longer go through the generic fillMetadataSegment(..., true) path that was designed for dynamic metadata routes.

What changed

  • New fillStaticMetadataSegment(segment, lastSegment) function that:
    • Normalizes app path segments
    • Replaces dynamic and catch-all segments with - placeholder
    • Preserves metadata filename suffix logic for route groups and parallel routes
  • fillMetadataSegment() now short-circuits to fillStaticMetadataSegment() when isStatic=true
  • Webpack static metadata image loader now emits the final static URL string at build time instead of generating runtime code that awaits props.params
  • Dev bundler uses fillStaticMetadataSegment() for static metadata file mapping

Relevance to vinext

If vinext serves static metadata files (favicon, icons, etc.) from the app/ directory, it needs to correctly compute their URLs. The new static path handles:

  • Root favicon (/favicon.ico)
  • Static metadata under dynamic parents (/blog/-/favicon.ico)
  • Route-group / parallel-route suffix behavior (hash-based suffixes)

The routing layer that scans app/ directories should use equivalent logic when resolving static metadata file paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nextjs-trackingTracking issue for a Next.js canary change relevant to vinext

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions