($appearance ?? 'system') == 'dark'])> @php // SEO server-side (tanpa SSR — docs-ai/11-seo.md §2). // $page props (termasuk lazy settings) sudah di-resolve sebelum view render. $pageProps = $page['props'] ?? []; $seo = $pageProps['seo'] ?? []; $settings = $pageProps['settings'] ?? []; $siteName = $settings['site_name'] ?? config('app.name'); $metaTitle = $settings['seo_meta_title'] ?? $siteName; $pageTitle = $seo['title'] ?? null; $title = $pageTitle ? $pageTitle.' | '.$metaTitle : $metaTitle; $description = $seo['description'] ?? $settings['seo_meta_description'] ?? ''; $ogImage = $seo['image'] ?? (($settings['seo_og_image'] ?? null) ? url('/storage/'.$settings['seo_og_image']) : null); $currentUrl = url()->current(); $locale = app()->getLocale(); $ogType = $seo['og_type'] ?? 'website'; $seoSchemas = $seo['schema'] ?? []; // Hreflang alternates: halaman detail (blog/proyek) mengirim // props `locale_slugs` (slug per locale) — bangun URL dari sana; // halaman statis pakai str_replace prefix locale. $localeSlugs = $pageProps['locale_slugs'] ?? null; $hreflangUrls = []; if (is_array($localeSlugs) && ! empty($localeSlugs)) { $pathAfterLocale = (string) preg_replace('#^/'.preg_quote($locale, '#').'#', '', (string) parse_url($currentUrl, PHP_URL_PATH)); $segments = explode('/', trim($pathAfterLocale, '/')); foreach (config('app.supported_locales') as $lang) { $slug = $localeSlugs[$lang] ?? null; if (! is_string($slug) || $slug === '') { continue; } $localeSegments = $segments; $localeSegments[count($localeSegments) - 1] = $slug; $hreflangUrls[$lang] = url('/'.$lang.'/'.implode('/', $localeSegments)); } } if ($hreflangUrls === []) { foreach (config('app.supported_locales') as $lang) { $hreflangUrls[$lang] = str_replace('/'.$locale, '/'.$lang, $currentUrl); } } // JSON-LD Organization — hanya di halaman depan. $organizationSchema = null; if (($page['component'] ?? null) === 'frontend/home') { $organizationSchema = [ '@context' => 'https://schema.org', '@type' => 'Organization', 'name' => $siteName, 'url' => url('/'), 'logo' => ($settings['site_logo_color'] ?? null) ? url('/storage/'.$settings['site_logo_color']) : url('/assets-elfatih/logo_modelight.png'), 'contactPoint' => array_filter([ '@type' => 'ContactPoint', 'email' => $settings['contact_email'] ?? null, 'telephone' => $settings['contact_phone'] ?? null, 'contactType' => 'customer service', ]), 'sameAs' => array_values(array_filter([ $settings['social_instagram'] ?? null, $settings['social_facebook'] ?? null, $settings['social_twitter'] ?? null, $settings['social_linkedin'] ?? null, $settings['social_youtube'] ?? null, ])) ?: null, ]; } @endphp {{ $title }} @if (! empty($seo['robots'])) @endif {{-- Priority hint: preload hero/LCP image agar di-fetch sebelum JS hydrate --}} @if (! empty($seo['preload_image'])) @endif @foreach (config('app.supported_locales') as $ogAltLocale) @if ($ogAltLocale !== $locale) @endif @endforeach @if ($ogImage) @endif @if ($ogType === 'article') @if (! empty($seo['published_time'])) @endif @if (! empty($seo['author'])) @endif @endif @if ($ogImage) @endif @foreach ($hreflangUrls as $lang => $href) @endforeach {{-- x-default: versi locale fallback dari URL yang SAMA (bukan homepage) --}} @if ($organizationSchema) {{-- JSON_HEX_TAG: escape < > agar aman dari script break-out (stored XSS) --}} @endif {{-- JSON-LD per halaman (Breadcrumb/Product/Service/Article) — server-side, terbaca crawler walau JS gagal --}} @if ($seoSchemas !== []) @foreach ($seoSchemas as $seoSchema) @endforeach @endif {{-- Inline script to detect system dark mode preference and apply it immediately --}} {{-- Inline style to set the HTML background color based on our theme in app.css --}} @php $favicon = $settings['site_favicon'] ?? null; @endphp @if($favicon) @else @endif @viteReactRefresh @vite(['resources/css/app.css', 'resources/js/app.tsx', "resources/js/pages/{$page['component']}.tsx"]) {{-- Tanpa di sini — sudah ada statis di atas; mencegah duplikat tag title --}} <x-inertia::head /> </head> <body class="font-sans antialiased"> <x-inertia::app /> </body> </html>