-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata not working for not found page #52636
Comments
Why would you want to do that? |
here only page.tsx works |
Yeah I had the same issue, we should be able to add a title tag even if it's a 404 page |
Because I want to show a title for the user :) I think that it's a user experience. Also, there is a title in default 404 not found page. I want to customize it. |
### What? Support metadata exports for `not-found.js` conventions ### Why? We want to define metadata such as title or description basic properties for error pages, including 404 and 500 which referrs to `error.js` and `not-found.js` convention. See more requests in #45620 Did some research around metadata support for not-found and error convention. It's possible to support in `not-found.js` when it's server components as currently metadata is only available but for `error.js` it has to be client components for now so it's hard to support it for now as it's a boundary. ### How? We determine the convention if we're going to render is page or `not-found` boundary then we traverse the loader tree based on the convention type. One special case is for redirection the temporary metadata is not generated yet, we leave it as default now. Fixes #52636
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:21:34 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8112 Binaries: Node: 19.4.0 npm: 9.4.2 Yarn: 1.22.19 pnpm: 8.6.5 Relevant Packages: next: 13.4.10-canary.6 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.0.2 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Metadata (metadata, generateMetadata, next/head)
Link to the code that reproduces this issue or a replay of the bug
npx create-next-app -e reproduction-template
To Reproduce
.
Describe the Bug
I want to add metada to not-found page but it doesn't work.

So, how can I add metadata to not-found.tsx?
Expected Behavior
.
Which browser are you using? (if relevant)
Google Chrome
How are you deploying your application? (if relevant)
Vercel
NEXT-1446
The text was updated successfully, but these errors were encountered: