Skip to content

How to correctly handle _meta files for dynamic routes? #4814

@zevnda

Description

@zevnda

I could very well just be missing something obvious, but I can't seem to get _meta files to work for dynamic routes.

When doing the following, I would expect the nabvar to be hidden on all routes within dynamic-route/ only; however, it is affecting every route instead, including the dynamic routes

dynamic-route/
├── _meta.ts
└── [slug]/
    └── page.tsx
// _meta.ts
export default {
  '*': {
    type: 'page',
    theme: {
      navbar: false,
    },
  },
}

Trying a global approach with a combination of attempts just gives me errors

app/
├── _meta.global.ts
├── layout.tsx
└── dynamic-route/
    └── [slug]/
        └── page.tsx
// _meta.global.ts
export default {
  // ... other routes working fine
  'dynamic-route': {
    type: 'page',
    theme: {
      navbar: false,
    },
  },
}
// _meta.global.ts
export default {
  // ... other routes working fine
  '[slug]': {
    type: 'page',
    theme: {
      navbar: false,
    },
  },
}

and a few more..

Error: Validation of "_meta" file has failed.
The field key "dynamic-route" in `_meta` file refers to a page that cannot be found, remove this key from "_meta" file.

Error: Validation of "_meta" file has failed.
The field key "[slug]" in `_meta` file refers to a page that cannot be found, remove this key from "_meta" file.

At this point, I'm stumped on how to handle this correctly, so any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions