Next.js Discord

Discord Forum

Buggy Nextjs Metadata

Unanswered
Golden paper wasp posted this in #help-forum
Open in Discord
Golden paper waspOP
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: [

],
};

6 Replies

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
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" };