Buggy Nextjs Metadata
Unanswered
Golden paper wasp posted this in #help-forum
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
@Golden paper wasp I have a metadata object in my layout file that doesn't show up titles, I am using the Nextjs 13 /app version
export const metadata: Metadata = {
title: {
default: 'Web Title',
template: '%s | Web Title',
},
description: '',
category:
'',
abstract:
'',
keywords: [
],
};
Is this file marked with “use client�
Golden paper waspOP
Ya
Then it doesn’t work since the metadata api only works in server components
@joulev Is this file marked with “use client�
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
@Golden paper wasp Appreciate it man thanks. I removed the “use client†it works on that layout. But the template doesn’t from other pages
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" };