@if(app()->environment('production') && !str_contains(request()->getHost(), 'dev')) @endif @php $currentRoute = Route::currentRouteName(); $seo = getSeoSetting($currentRoute); // Prioritize passed variables, then DB SEO settings, then default fallback $metaTitle = isset($meta_title) ? $meta_title : ($seo ? $seo->meta_title : (getSeoMeta($currentRoute, 'meta_title') ?: env('APP_NAME'))); $metaDescription = isset($meta_description) ? $meta_description : ($seo ? $seo->meta_description : getSeoMeta($currentRoute, 'meta_description')); $metaKeywords = isset($meta_keywords) ? $meta_keywords : ($seo ? $seo->meta_keywords : getSeoMeta($currentRoute, 'meta_keywords')); // Append page number for paginated pages to avoid duplicate titles/descriptions $currentPage = request()->integer('page', 1); if ($currentPage > 1) { $pageSuffix = ' - صفحة ' . $currentPage; $metaTitle .= $pageSuffix; $metaDescription .= $pageSuffix; } $canonicalUrl = ($seo && $seo->canonical_url) ? $seo->canonical_url : url()->current(); $canonicalUrl = strtok($canonicalUrl, '?'); if ($currentPage > 1) { $canonicalUrl .= '?page=' . $currentPage; } @endphp