vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.02k stars 26.7k forks source link

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

Open azvyae opened 9 months ago

azvyae commented 9 months ago

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:

Expected/Solution

Verify 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

Quramy commented 9 months ago

I encounter the same issue too .

gabyrusu commented 6 months ago

Same here. Any news on this?

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!

hmacafee commented 6 months ago

Also experiencing here.

nic-vo commented 5 months ago

Experiencing this but with route groups. I think the issue is that Next.js only evaluates metadata from routes / segments that are actually used for routing / navigation, so that doesn't include parallel routes nor route groups (any pages or layouts in the "@parallelroute" and "(groupname)" syntax, respectively).

If you define metadata in a normal, non-parallel , and non-route group layout or page (e.g. "app/category/page.tsx" as opposed to "app/@category/page.tsx") it may be evaluated correctly

kpman7 commented 4 weeks ago

Any update on this issue?

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!