{{-- --}} @php $settings = \App\Models\Setting::find(1); $seoKey = $seoKey ?? null; // Для страниц с множественными записями (товар, специалист, статья, зазазы) $isItemPage = (isset($item) && ( request()->routeIs('showCardPage') || // Карточка товара request()->routeIs('showPostPage') || // Отдельный пост в журнале request()->routeIs('showOrderPage') // Отдельный заказ )) || (isset($professional) && request()->routeIs('showSpecialistPage')); // Профиль специалиста // Определяем город для SEO $seoCity = null; if (isset($selectedCityObj) && is_object($selectedCityObj) && isset($selectedCityObj->title)) { $seoCity = $selectedCityObj->title; } elseif (isset($selectedCity) && is_object($selectedCity) && isset($selectedCity->title)) { $seoCity = $selectedCity->title; } elseif (isset($selectedCity) && is_string($selectedCity)) { $seoCity = $selectedCity; } elseif (isset($city)) { $seoCity = $city; } elseif (session('city')) { $seoCity = session('city'); } else { $seoCity = 'Москва'; } // Склоняем город в падеж "где" для использования в текстах $declinedCity = $seoCity ? \morphos\Russian\GeographicalNamesInflection::getCase($seoCity, 'locative') : null; $isLivewireChat = request()->routeIs('chat.index') || request()->routeIs('chat'); @endphp {{-- SEO для специалистов (каталог) --}} @if(request()->routeIs('showCatalogPage')) @if(isset($subcategory_query) && $subcategory_query) {{ mb_ucfirst(mb_strtolower($subcategory_query->meta_title ?? $subcategory_query->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @elseif(isset($category_query) && $category_query) {{ mb_ucfirst(mb_strtolower($category_query->meta_title ?? $category_query->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @else @php $seo = $seoKey ? collect($settings->seo ?? [])->firstWhere('page', $seoKey) : collect($settings->seo ?? [])->firstWhere('page', 'standart'); @endphp @if($seo) {{ ($seo['title'] ?? '') . ($declinedCity ? ' в ' . $declinedCity : '') }} @endif @endif {{-- SEO для продуктов (каталог) --}} @elseif(request()->routeIs('showProductPage') || request()->routeIs('showProductCategoryPage') || request()->routeIs('showProductSubcategoryPage')) @if(isset($selectedSubcategory)) {{ mb_ucfirst(mb_strtolower($selectedSubcategory->meta_title ?? $selectedSubcategory->name ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @elseif(isset($selectedCategory)) {{ mb_ucfirst(mb_strtolower($selectedCategory->meta_title ?? $selectedCategory->name ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @else {{-- Fallback to general settings via $seoKey 'products' --}} @php $seo = $seoKey ? collect($settings->seo ?? [])->firstWhere('page', $seoKey) : collect($settings->seo ?? [])->firstWhere('page', 'standart'); @endphp @if($seo) {{ ($seo['title'] ?? '') . ($declinedCity ? ' в ' . $declinedCity : '') }} @endif @endif {{-- SEO для блога (каталог) --}} @elseif(request()->routeIs('filterBlogs')) @if(isset($selectedSubcategory)) {{ mb_ucfirst(mb_strtolower($selectedSubcategory->meta_title ?? $selectedSubcategory->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @elseif(isset($selectedCategory)) {{ mb_ucfirst(mb_strtolower($selectedCategory->meta_title ?? $selectedCategory->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @endif {{-- SEO для заказов (каталог) --}} @elseif((request()->routeIs('showOrdersCatalogPage') || request()->routeIs('showOrdersCatalogCategory') || request()->routeIs('showOrdersCatalogSubcategory'))) @if(isset($selectedSubcategory)) {{ mb_ucfirst(mb_strtolower($selectedSubcategory->meta_title ?? $selectedSubcategory->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @elseif(isset($selectedCategory)) {{ mb_ucfirst(mb_strtolower($selectedCategory->meta_title ?? $selectedCategory->title ?? '')) . ($declinedCity ? ' в ' . $declinedCity : '') }} @else @php $seo = collect($settings->seo ?? [])->firstWhere('page', 'orders') ?? collect($settings->seo ?? [])->firstWhere('page', 'standart'); @endphp @if($seo) {{ ($seo['title'] ?? '') . ($declinedCity ? ' в ' . $declinedCity : '') }} @endif @endif {{-- --}} {{-- SEO для отдельных страниц (товар, пост, заказ, специалист) --}} @elseif($isItemPage) @php $seoItem = null; if (request()->routeIs('showSpecialistPage') && isset($professional)) { $seoItem = $professional; } elseif (isset($item)) { $seoItem = $item; } @endphp @if(isset($seo_title) || isset($seo_descr) || isset($seo_key)) {{ $seo_title ?? ($seoItem->seo_title ?? $seoItem->name ?? '') }} @elseif($seoItem) @if(request()->routeIs('showSpecialistPage') && $seoItem->specialistInfo) {{ $seoItem->specialistInfo->seo_title ?? $seoItem->specialistInfo->company_name ?? '' }} @else {{-- SEO для страницы товара, поста, заказа --}} {{ $seoItem->seo_title ?? $seoItem->name ?? '' }} @endif @else {{-- Fallback if $isItemPage is true but $item/$professional is not set (should not happen if logic is correct) --}} {{ config('app.name') }} | {{ $page_title ?? 'Ремонт.рф' }} @endif @else @php // Получаем routeName $routeName = Route::currentRouteName(); // Список страниц, для которых уже реализовано SEO $skipSeo = ['showOrdersCatalogPage', 'showOrdersCatalogCategory', 'showOrdersCatalogSubcategory', 'showCatalogPage', 'showProductPage', 'showProductCategoryPage', 'showProductSubcategoryPage']; // Маппинг routeName -> seoKey для статичных страниц $seoRouteMap = [ 'showMyProjectPage' => 'my-project', 'showFavoritesPage' => 'favorites', 'showProfilePage' => 'profile', 'chat.index' => 'chat', 'chat' => 'chat', 'showRegisterTwoPage' => 'registerTwo', 'showRegisterOnePage' => 'registerOne', 'showContactPage' => 'contact', 'showAboutPage' => 'about', 'showFaqPage' => 'faq', 'showJournalPage' => 'journal', 'suppliers.info' => 'supplier-info', 'supplier.register' => 'supplier-register', ]; // Если это не orders, specialists, products — выводим SEO из настроек if (!in_array($routeName, $skipSeo)) { $seoKey = $seoRouteMap[$routeName] ?? ($seoKey ?? $routeName); $seo = $seoKey ? collect($settings->seo ?? [])->firstWhere('page', $seoKey) : collect($settings->seo ?? [])->firstWhere('page', 'standart'); } @endphp @if(!in_array($routeName, $skipSeo) && isset($seo)) {{ $seo['title'] ?? '' }} @else {{ config('app.name') }} | {{ $page_title ?? 'Ремонт.рф' }} @endif @endif {{-- --}} {{-- --}} {{-- --}} {{-- @livewireStyles --}} {{-- @livewireScripts --}} {{-- Основной файл стилей для всего сайта --}} {{-- Дополнительные стили и скрипты для чата --}} @if($isLivewireChat) @php $manifestPath = public_path('build/manifest.json'); $hasManifest = file_exists($manifestPath); @endphp @if($hasManifest) @vite(['resources/css/app.css', 'resources/js/app.js']) @else {{-- Fallback: Загружаем только Alpine.js из CDN если Vite манифест не найден --}} {{-- ВНИМАНИЕ: Tailwind классы не будут работать без собранных ассетов --}} @endif @endif {{-- Additional head content from child views --}} @yield('head')