Buggy Nextjs Metadata
Unanswered
Golden paper wasp posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Golden paper waspOP
I have a metadata object in my layout file that doesn't show up titles, I am using the Nextjs 13
export const metadata: Metadata = {
title: {
default: 'Web Title',
template: '%s | Web Title',
},
description: '',
category:
'',
abstract:
'',
keywords: [
],
};
/app
versionexport const metadata: Metadata = {
title: {
default: 'Web Title',
template: '%s | Web Title',
},
description: '',
category:
'',
abstract:
'',
keywords: [
],
};
6 Replies
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
Is this file marked with “use client�
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Golden paper waspOP
Ya
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
Then it doesn’t work since the metadata api only works in server components
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Golden paper waspOP
Appreciate it man thanks. I removed the “use client†it works on that layout. But the template doesn’t from other pages
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
All pages must also be server components for the metadata api to work
You can make a wrapper like this
// page.client.tsx
"use client";
export default function PageClient() {
useSomeHook();
return <Something />;
}
// page.tsx
import PageClient from "./page.client";
export default function Page() {
return <PageClient />;
}
export const metadata = { title: "My Page" };