Skip to content

scanMetadataFiles should ignore @slot and _private directories #519

@NathanDrake2406

Description

@NathanDrake2406

Summary

scanMetadataFiles() currently recurses into every directory except route groups, so metadata files under parallel-route slots and private folders become public metadata URLs.

Reproduction

Given an app dir with:

app/
  @slot/icon.png
  _private/icon.png

scanMetadataFiles(appDir) currently returns routes with:

  • servedUrl: "/@slot/icon"
  • servedUrl: "/_private/icon"

Expected

  • @slot directories should not produce public metadata URL segments. They are parallel-route internals, not part of the URL space.
  • _private directories should be skipped entirely, matching Next.js private-folder behavior.

Why this looks wrong

Likely fix

Teach scanMetadataFiles() to:

  1. Skip _private directories entirely
  2. Recurse into @slot directories without adding them to urlPrefix
  3. Add coverage in tests/metadata-routes.test.ts for both cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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