#Next 13 metadata for not-found page
39 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
is your not-found page server or client component?
yes, it just still keeps the one set in global metadata for layout.tsx
I tried both
export const metadata = {
title: '404 not found page',
};
export const metadata = {
title: { absolute: '404 not found page' },
};
this is the one in app/not-found.tsx?
yup
and you go to http://localhost:3000/some-url-not-exist ?
exactly
and here is metadata for app/layout.tsx
title: {
default: title,
template: '%s | My Site name',
},
then it should work, have you tried remove .next folder and restart the server?
I tried everything, maybe the problem in the version of next js i'm using (13.4.19). The metadata works for all pages I have except this one, I found a thread on github with the same problem but their solution doesn't work for me
did you set a global metadata for title as well?
yes
export const metadata: Metadata = {
title: {
default: "Create Next App",
template: "%s | My Site name",
},
description: "Generated by create next app",
};
and
export const metadata: Metadata = {
title: "404",
};
hmmm, could you also try to hit error page through notFound() from existing page?
the title doesn't set if hit notFound()
could you try access some random url which is not exist?
btw look like you need to upgrade to get it fix
Actually it doesn't work even with a random page for me, it just keeps title which was set in title.default
upgrade to which version?
is there a reason you using old version instead of latest one?
I think I found a way to fix it, I just added metadata to [...not-found]/page.tsx and it works
lol
np
hell, it still doesn't work by hitting notFound(), don't you know in which version it was fixed?
oh well, im not sure