NEXTJS_NO_METADATA_APINot using Next.js Metadata API
Next.js 13+ has a built-in Metadata API that's better than react-helmet.
Use the Metadata API in your layout or page:
// app/page.tsx
import { Metadata } from 'next';
export const metadata: Metadata = {
title: 'Page Title',
description: 'Page description',
openGraph: {
title: 'OG Title',
description: 'OG Description',
images: ['/og-image.jpg'],
},
};
// For dynamic metadata
export async function generateMetadata({ params }): Promise<Metadata> {
const product = await getProduct(params.id);
return {
title: product.name,
description: product.description,
};
}