import { Title, Meta, Link } from "@solidjs/meta"; import { useLocation } from "@solidjs/router"; import { useSite } from "~/context/SiteContext"; import { resolvePageHeadMeta, type PageHeadProps } from "~/components/page-head-meta"; // Re-export the pure types + resolver so existing imports // (`import { PageHead } from "~/components/PageHead"`) plus any consumer that // wants the meta helper resolve from a single module path. export { resolvePageHeadMeta, type PageHeadProps, type ResolvedPageHeadMeta } from "~/components/page-head-meta"; /** * PageHead component for consistent page metadata across the application. * * Site-aware: reads `useSite()` for the per-site title suffix, * canonical domain, and default OpenGraph image, so the same component * renders `" | Michael Freno"` / `" | Nessa"` / … depending on the active * subdomain. Canonical URLs are auto-derived from the site domain + the * current router pathname unless an explicit `canonical` override is given. * * The actual derivation lives in the pure `resolvePageHeadMeta` helper (see * `~/components/page-head-meta.ts`) so it can be unit-tested without a DOM. * * @example * ```tsx * * ``` */ export default function PageHead(props: PageHeadProps) { const site = useSite(); const location = useLocation(); const meta = () => resolvePageHeadMeta(props, site(), location.pathname); return ( <> {meta().title} {meta().description && ( )} {/* Open Graph / Social Media Tags */} {meta().ogDescription && ( )} ); } // Named export for consistency export { PageHead };