#Next 13 metadata for not-found page

39 messages · Page 1 of 1 (latest)

tacit bane
#

Cannot overwrite a global <title> metadata for not-found page. I tried to paste <title> inside page itself but in this case it just puts both global title and the one is set in not-found page. export const metadata and export const generateMetadata doesn't work as well

dense frostBOT
#

🔎 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)

sudden grove
tacit bane
#

@sudden grove server

#

but can be client, doesnt matter for me

sudden grove
#

export const metadata should work then

#

but it didn't change the title for you?

tacit bane
#

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' },
};

sudden grove
tacit bane
#

yup

sudden grove
tacit bane
#

exactly

#

and here is metadata for app/layout.tsx

title: {
default: title,
template: '%s | My Site name',
},

sudden grove
#

then it should work, have you tried remove .next folder and restart the server?

tacit bane
#

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

sudden grove
#

let me try it on 13.4.19 real quick

#

it works for me on 13.4.19

tacit bane
#

did you set a global metadata for title as well?

sudden grove
#

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",
};
tacit bane
#

hmmm, could you also try to hit error page through notFound() from existing page?

sudden grove
#

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

tacit bane
#

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?

sudden grove
#

is there a reason you using old version instead of latest one?

tacit bane
#

I think I found a way to fix it, I just added metadata to [...not-found]/page.tsx and it works

sudden grove
#

lol

tacit bane
#

maybe not a best solution but at least it works haha

#

but thank you!

sudden grove
#

np

tacit bane
#

hell, it still doesn't work by hitting notFound(), don't you know in which version it was fixed?