Missing metadata on 404 page after invoking notFound() #77512
Labels
linear: next
Confirmed issue that is tracked by the Next.js team.
Metadata
Related to Next.js' Metadata API.
Not Found
Related to the not-found.tsx file or the notFound() function.
Link to the code that reproduces this issue
https://github.com/alyustik/nextjs-notfound-regression
To Reproduce
Current vs. Expected behavior
Current: global metadata, that was defined in root layout is missing on the non-existing page
Expected: global metadata preserves on non-existing page
Provide environment information
Which area(s) are affected? (Select all that apply)
Not Found, Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
If it helps, that only happens on pages, where notFound() was invoked.
So if I would create directories like
And then I navigate to /non-existing-page - meta would work.
But if I navigate to /articles/non-existing-page - meta wouldn't work.
Happens with both generateMetadata() and metadata object.
I also tried to add metadata on not-found.tsx but it was ignored.
Issue can be reproduced starting from 15.2.0
The text was updated successfully, but these errors were encountered: