{{-- Normalize SEO array --}} @php $seo = $seo ?? []; $currentUrl = url()->current(); $pageTitle = $seo['meta_title'] ?? ($title ?? '') . env('APP_NAME'); $metaDescription = $seo['meta_description'] ?? config('seo.default_description', 'Phonix USA - Wholesale electronics distributor. Best prices on laptops, gaming, smartphones, and more. B2B wholesale supplier.'); $ogTitle = $seo['og_title'] ?? $pageTitle; $ogDescription = $seo['og_description'] ?? $metaDescription; $defaultOgImage = \App\Services\SeoService::ogImageUrl('default'); $routeName = Route::currentRouteName(); $ogImageMap = [ 'website.home.index' => $defaultOgImage, 'website.about.index' => \App\Services\SeoService::ogImageUrl('about'), 'website.about.customer' => \App\Services\SeoService::ogImageUrl('customer_process'), 'website.about.vendor' => \App\Services\SeoService::ogImageUrl('vendor_process'), 'website.about.terms' => \App\Services\SeoService::ogImageUrl('terms'), 'website.about.privacy' => \App\Services\SeoService::ogImageUrl('privacy'), 'website.about.contact' => \App\Services\SeoService::ogImageUrl('contact'), ]; if (!empty($seo['og_image'])) { $ogImage = $seo['og_image']; } elseif (isset($ogImageMap[$routeName])) { $ogImage = $ogImageMap[$routeName]; } else { $ogImage = $defaultOgImage; } $canonical = $seo['canonical'] ?? ($canonicalUrl ?? $currentUrl); $robots = $seo['robots'] ?? (isset($shouldNoIndex) && $shouldNoIndex ? 'noindex,follow' : 'index,follow'); $ogType = $seo['og_type'] ?? 'website'; @endphp {{-- SEO Core --}}