Skip to main content

Function: createMetadata()

@arolariu/website


@arolariu/website / metadata / createMetadata

Function: createMetadata()

createMetadata(partialMetadata?): Readonly<Metadata>

Defined in: metadata.ts:394

Creates page-specific metadata by merging with base configuration.

Parameters

partialMetadata?

PartialMetadata = {}

Optional page-specific metadata overrides

Returns

Readonly<Metadata>

Complete metadata object with base configuration merged with overrides

Remarks

Usage Pattern: Call this function in page-level generateMetadata or static metadata exports to create page-specific SEO metadata that inherits from the base configuration.

Merge Behavior:

  • Base metadata properties are inherited
  • Partial metadata properties override base properties
  • title and description automatically populate OpenGraph and Twitter metadata
  • locale determines OpenGraph locale and alternate locale mapping

Locale Mapping:

  • enen_US (OpenGraph locale)
  • roro_RO (OpenGraph locale)
  • Unknown locales default to en_US

Type Safety: Returns readonly metadata to prevent accidental mutations.

Examples

// In a page component
export const metadata = createMetadata({
title: "Invoice Dashboard",
description: "View and manage your invoices",
locale: "en",
openGraph: {
images: [{ url: "/og-invoice.png" }],
},
});
// Dynamic metadata generation
export async function generateMetadata({ params }): Promise<Metadata> {
const invoice = await fetchInvoice(params.id);
return createMetadata({
title: `Invoice ${invoice.name}`,
description: `Invoice details for ${invoice.merchantName}`,
});
}

See

  • metadata Base metadata configuration
  • PartialMetadata Type definition for partial metadata
// was this page useful?