import type { ReactElement } from 'react' export interface SeoAuthor { name: string url?: string /** @default "Person" */ type?: 'Person' | 'Organization' } export interface SeoArticle { /** @default "Article" */ type?: 'Article' | 'BlogPosting' | 'NewsArticle' publishedAt?: string updatedAt?: string authors?: readonly SeoAuthor[] section?: string tags?: readonly string[] } export interface SeoBreadcrumb { name: string url: string } export interface SeoProps { title: string description?: string canonical?: string image?: string imageAlt?: string siteName?: string type?: 'website' | 'article' | 'profile' locale?: string noindex?: boolean /** * Shape of the link preview card on X. * * Emitted as ``: that is the attribute name X's * crawler still reads, so the tag keeps the platform's former name even * though the prop does not. */ card?: 'summary' | 'summary_large_image' /** Explicit article facts used to generate Article JSON-LD. */ article?: SeoArticle /** Ordered path from the site root to the current page. */ breadcrumbs?: readonly SeoBreadcrumb[] jsonLd?: Record | Array> } /** * Render React 19 document metadata for search engines and social previews. * React hoists these tags into `` during server rendering. */ export function Seo({ title, description, canonical, image, imageAlt, siteName, type = 'website', locale, noindex = false, card, article, breadcrumbs, jsonLd, }: Readonly): ReactElement { const structuredData = createStructuredData({ title, description, canonical, image, article, breadcrumbs, jsonLd, }) return ( <> {title} {description ? : null} {canonical ? : null} {description ? : null} {canonical ? : null} {siteName ? : null} {locale ? : null} {image ? : null} {image && imageAlt ? : null} {description ? : null} {image ? : null} {image && imageAlt ? : null} {structuredData ? (