// The CMS's site answer (pagination form and segments, the home crumb, the // HTML sitemap paths, the content URL patterns …), fetched once per page // through GET /api/__seo__/site and shared by every caller on the server // and in the browser (stable key, so the payload carries it to hydration). // `data.value` is null with the layer off, with a backend before SEO // v0.2.0 or with the backend down. // // const { data: site } = await useSeoSite() import type { SeoSiteAnswer } from '../utils/types.ts' export const SEO_SITE_KEY = 'seo-layer:site' export function useSeoSite() { return useFetch('/api/__seo__/site', { key: SEO_SITE_KEY, transform: (res: { site?: SeoSiteAnswer | null } | null): SeoSiteAnswer | null => res && typeof res === 'object' && res.site && typeof res.site === 'object' ? res.site : null, default: () => null, dedupe: 'defer', }) }