{{-- Metadata central del . Recibe el paquete SEO de la página ($page, el $seoPage que inyecta el View::composer) o null. Si es null —vista no registrada, ej. /estimate— cae a los defaults derivados de config/company.php, sin romper. Reemplaza a los viejos @yield('title')/@yield('description') del layout: el title/description/OG salen de UNA sola fuente, nunca duplicados. --}} @props(['page' => null]) @php $meta = $page['meta'] ?? []; $companyName = (string) config('company.legal_name'); $defaultTitle = $companyName.' — Pools, Pavers, Patios & Driveways in South Florida'; $defaultDescription = 'Premium pool renovations, paver driveways, patios, pool decks, and concrete overlays for Broward & Palm Beach County homes. Licensed, insured, and built to last.'; $title = trim((string) ($meta['title'] ?? '')) ?: $defaultTitle; $description = trim((string) ($meta['description'] ?? '')) ?: $defaultDescription; $keywords = $meta['keywords'] ?? []; $resolvedKeywords = is_array($keywords) ? collect($keywords)->map(fn ($k) => trim((string) $k))->filter()->implode(', ') : trim((string) $keywords); // Canonical: absoluta. Si no hay canonicalUrl en el paquete, la URL actual. $canonicalRaw = $meta['canonicalUrl'] ?? url()->current(); $canonicalUrl = \Illuminate\Support\Str::startsWith((string) $canonicalRaw, ['http://', 'https://']) ? (string) $canonicalRaw : url((string) $canonicalRaw); // og:image: ruta lógica de Vite (o el logo por defecto), resuelta y absoluta. $ogImageLogical = $meta['ogImage'] ?? 'resources/images/logo-pools.png'; $ogImageAsset = Vite::asset($ogImageLogical); $ogImage = \Illuminate\Support\Str::startsWith($ogImageAsset, ['http://', 'https://']) ? $ogImageAsset : url($ogImageAsset); $robots = app()->isProduction() ? 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' : 'noindex, nofollow'; @endphp {{-- Metas base --}} {{ $title }} @if ($resolvedKeywords !== '') @endif {{-- Open Graph / Facebook --}} {{-- Twitter --}} {{-- Favicon --}}