Skip to content

NextJS metadata don't work properly on parallel routes #59316

@azvyae

Description

@azvyae

Link to the code that reproduces this issue

https://github.com/azvyae/next-14-repro-bug

To Reproduce

  1. npm run build
  2. npm start
  3. Navigate to /parallel route
  4. Compare it to /non-parallel route

Current vs. Expected behavior

Problems

Metadata (especially) title not working properly when defined inside page.tsx/layout.tsx inside the parallel route folder (the folder with "@" in it), those problems are:

  • It won't respects the title template defined inside the root layout metadata

  • Even though the UI rendered for each of them, the title is won't changed

  • Currently, the metadata used would be the latest folder ordered by alphabet of the /@folder/page.tsx file if there are parallel routes implemented.

Expected/Solution

  • It should respect the title template defined in the root layout/parent layout

  • Because it would be confusing if we render two route at once (because its capability to render this way by parallel routes), would be possible if we render based on shown inside the layout logic? Like role_admin should render @admin otherwise @guest, because this only make the route rendered once, it should show one metadata only.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Tue Nov 28 19:11:52 UTC 2023
Binaries:
  Node: 20.9.0
  npm: 10.1.0
  Yarn: N/A
  pnpm: 8.11.0
Relevant Packages:
  next: 14.0.4-canary.43
  eslint-config-next: 14.0.4-canary.43
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Metadata (metadata, generateMetadata, next/head), Routing (next/router, next/navigation, next/link)

Additional context

No response

NEXT-1811

Metadata

Metadata

Assignees

Labels

Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions