import type { Metadata } from 'next'; import { site } from '@/config/site'; interface EditorPage { root?: { props?: { title?: string; description?: string; }; }; } export function pageMetadata(page: EditorPage, overrides: { path?: string } = {}): Metadata { const props = page.root?.props ?? {}; const title = props.title ?? site.name; const description = props.description ?? site.description; return { title: { absolute: title }, description, alternates: overrides.path ? { canonical: overrides.path } : undefined, }; }