import type { Metadata } from 'next' interface CreateMetadataOptions { title: string description: string path?: string ogImage?: string noIndex?: boolean } export function createMetadata({ title, description, path, ogImage, noIndex = false }: CreateMetadataOptions): Metadata { const metadata: Metadata = { title, description, openGraph: { title, description, type: 'website', ...(ogImage && { images: [{ url: ogImage }] }) }, twitter: { card: ogImage ? 'summary_large_image' : 'summary', title, description, ...(ogImage && { images: [ogImage] }) } } if (path) { metadata.alternates = { canonical: path } } if (noIndex) { metadata.robots = { index: false, follow: false } } return metadata }