Files
tehnobox/resources/views/layouts/shop.blade.php
ssww23 0ee9f05416
Some checks failed
Deploy / deploy (push) Has been cancelled
1
2026-03-17 01:59:00 +03:00

152 lines
7.0 KiB
PHP

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@php
$supportedLocales = (array) config('app.supported_locales', []);
$currentLocale = app()->getLocale();
$currentLocaleData = $supportedLocales[$currentLocale] ?? $supportedLocales[config('app.locale', 'ru')] ?? [];
$siteName = config('seo.site_name', config('app.name', 'PC Shop'));
$metaTitleRaw = trim($__env->yieldContent('meta_title'));
$metaTitle = $metaTitleRaw !== '' ? "{$metaTitleRaw} - {$siteName}" : __(config('seo.default_title', $siteName));
$metaDescription = trim($__env->yieldContent('meta_description')) ?: __(config('seo.default_description'));
$metaKeywords = trim($__env->yieldContent('meta_keywords')) ?: __(config('seo.default_keywords'));
$metaCanonical = trim($__env->yieldContent('meta_canonical')) ?: url()->current();
$metaOgType = trim($__env->yieldContent('meta_og_type')) ?: 'website';
$request = request();
$defaultNoIndex = $request->is('admin*')
|| $request->routeIs(
'favorites.*',
'compare.*',
'cart.*',
'checkout.*',
'account*',
'login',
'login.attempt',
'register',
'register.store'
);
$metaRobots = trim($__env->yieldContent('meta_robots')) ?: ($defaultNoIndex ? 'noindex,nofollow' : 'index,follow');
$metaImagePath = trim($__env->yieldContent('meta_image')) ?: config('seo.default_image');
$metaImage = str_starts_with($metaImagePath, 'http://') || str_starts_with($metaImagePath, 'https://')
? $metaImagePath
: url($metaImagePath);
$metaImageAlt = trim($__env->yieldContent('meta_image_alt')) ?: $metaTitle;
$siteUrl = url('/');
$companyName = config('shop.company_name', $siteName);
$companyDescription = __(config('shop.company_description', $metaDescription));
$companyPhone = trim((string) config('shop.contact_phone', ''));
$companyEmail = trim((string) config('shop.contact_email', ''));
$companyAddress = trim((string) __(config('shop.contact_address', '')));
$companyTelegram = trim((string) config('shop.contact_telegram', ''));
if ($companyTelegram !== '' && str_starts_with($companyTelegram, '@')) {
$companyTelegram = 'https://t.me/' . ltrim($companyTelegram, '@');
}
$organizationSchema = [
'@context' => 'https://schema.org',
'@type' => 'Organization',
'name' => $companyName,
'url' => $siteUrl,
'description' => $companyDescription,
];
if ($companyPhone !== '') {
$organizationSchema['telephone'] = $companyPhone;
}
if ($companyEmail !== '') {
$organizationSchema['email'] = $companyEmail;
}
if ($companyAddress !== '') {
$organizationSchema['address'] = [
'@type' => 'PostalAddress',
'streetAddress' => $companyAddress,
];
}
if ($companyTelegram !== '' && (str_starts_with($companyTelegram, 'http://') || str_starts_with($companyTelegram, 'https://'))) {
$organizationSchema['sameAs'] = [$companyTelegram];
}
$websiteSchema = [
'@context' => 'https://schema.org',
'@type' => 'WebSite',
'name' => $siteName,
'url' => $siteUrl,
'potentialAction' => [
'@type' => 'SearchAction',
'target' => route('search.index') . '?q={search_term_string}',
'query-input' => 'required name=search_term_string',
],
];
@endphp
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ $metaTitle }}</title>
<meta name="description" content="{{ $metaDescription }}">
<meta name="keywords" content="{{ $metaKeywords }}">
<meta name="robots" content="{{ $metaRobots }}">
<link rel="canonical" href="{{ $metaCanonical }}">
@foreach ($supportedLocales as $localeData)
<link rel="alternate" hreflang="{{ $localeData['hreflang'] ?? 'ru-RU' }}" href="{{ $metaCanonical }}">
@endforeach
<link rel="alternate" hreflang="x-default" href="{{ $metaCanonical }}">
<meta property="og:type" content="{{ $metaOgType }}">
<meta property="og:locale" content="{{ $currentLocaleData['og_locale'] ?? 'ru_RU' }}">
<meta property="og:site_name" content="{{ $siteName }}">
<meta property="og:title" content="{{ $metaTitle }}">
<meta property="og:description" content="{{ $metaDescription }}">
<meta property="og:url" content="{{ $metaCanonical }}">
<meta property="og:image" content="{{ $metaImage }}">
<meta property="og:image:alt" content="{{ $metaImageAlt }}">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="{{ $metaTitle }}">
<meta name="twitter:description" content="{{ $metaDescription }}">
<meta name="twitter:image" content="{{ $metaImage }}">
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=space-grotesk:400,500,600,700" rel="stylesheet" />
<link href="https://fonts.bunny.net/css?family=manrope:400,500,600,700" rel="stylesheet" />
@if (file_exists(public_path('build/manifest.json')) || file_exists(public_path('hot')))
@vite(['resources/css/app.css', 'resources/js/app.js'])
@endif
@unless($request->is('admin*'))
<script type="application/ld+json">
@json($organizationSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
</script>
<script type="application/ld+json">
@json($websiteSchema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
</script>
@endunless
@stack('structured_data')
</head>
<body class="pc-body">
<div class="pc-shell">
<x-header />
<main class="pc-main">
@if (session('status'))
<div class="pc-alert">{{ session('status') }}</div>
@endif
@if ($errors->any())
<div class="pc-alert pc-alert-error">{{ $errors->first() }}</div>
@endif
@yield('content')
</main>
@if (!request()->is('admin*'))
<x-chat-widget />
@endif
<x-footer />
</div>
@stack('scripts')
</body>
</html>