-
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
not-found.js doesn't read metadata #50566
Comments
I don't know for sure why it both doesn't read the metadata and just keeps refreshing every 4 seconds (in dev) but my workaround for the title not changing bit on the not-found page is by just returning something like this:
|
using @JesseKoldewijn solution can mess up the layout. ( if you have a RootLayout ) and then if you just have a head with a title in it. you will receive this error after routing ![]() |
I can the before mentioned work-around both just now on the latest canary and have been using this for a couple of months already as well. I'll create a reproduction for ya 👍 |
I've created a fork with the work-around for ya and thrown in in a PR on your reproduction repo so you can easily see the differences. 👍 |
Seems like an unrelated issue. I got a repro where I both tested having a layout with a title and without it. Not sure where you managed to get this error but it doesn't seem to relate to this work-around I've been using in multiple projects for the past weeks. |
Thanks @JesseKoldewijn, but I get errors in console when I set the HTML element within the not-found file. I'm also of the mindset I should be setting that only once in this project to be honest! |
The html and head element need to match the elements in your layout tho. |
Gotcha. Still, would expect it to take from the metadata export and not need this workaround, so I'll leave this open |
Yeah man I agree it is supposed to work as expected. Just wanted to share my work-around as more of a short-term fix 😉 |
Related discussions in #45620. |
Close this as duplicate, let's track in #45620 |
This closed issue has been automatically locked because it had no new activity for 2 weeks. 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.6.0: Mon May 8 23:12:01 PDT 2023; root:xnu-8796.140.12.505.1~5/RELEASE_ARM64_T6000 Binaries: Node: 16.13.0 npm: 8.1.0 Yarn: 1.22.11 pnpm: N/A Relevant packages: next: 13.4.5-canary.2 eslint-config-next: 13.4.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.0.4
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/lewisking/next-js-not-found-issue
To Reproduce
Visit localhost:3000/example-404, note that the browser title isn't set.
Describe the Bug
The browser title isn't set, which makes me believe the metadata export is ignored on not-found.js
Expected Behavior
I would expect the metadata export to be respected.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: