@if (isset($metatags) && isset($schema))
@else
{{-- Basic SEO for pages without metatags --}}
{{ config('settings.site_name') ?? 'ميبيكوم' }}
{{-- Security Headers --}}
{{-- Canonical URL --}}
{{-- Favicon --}}
{{-- PWA Manifest --}}
{{-- PWA Meta Tags --}}
{{-- Apple Touch Icons --}}
{{-- Microsoft Tiles --}}
{{-- Open Graph --}}
{{-- Twitter --}}
{{-- Performance --}}
{{-- Hreflang Tags --}}
@php
$locales = ['ar', 'en'];
$currentPath = request()->path();
$pathWithoutLocale = preg_replace('/^(ar|en)\/?/', '', $currentPath);
// Check if this is a blog page
if (preg_match('/^blogs\/(.+)$/', $pathWithoutLocale, $matches)) {
$currentSlug = urldecode($matches[1]);
// Try multiple methods to find the blog
$blog = \App\Models\Blog::whereRaw("JSON_EXTRACT(slug, '$.ar') = ?", [$currentSlug])
->orWhereRaw("JSON_EXTRACT(slug, '$.en') = ?", [$currentSlug])
->first();
// If not found with JSON_EXTRACT, try manual search
if (!$blog) {
$blogs = \App\Models\Blog::all();
foreach ($blogs as $b) {
foreach (['ar', 'en'] as $lang) {
$blogSlug = $b->getTranslation('slug', $lang);
if ($blogSlug === $currentSlug) {
$blog = $b;
break 2;
}
}
}
}
if ($blog) {
foreach ($locales as $locale) {
$localizedUrl = $blog->getLocalizedUrl($locale);
if ($localizedUrl) {
echo '';
}
}
// Add x-default pointing to Arabic (default language)
$defaultUrl = $blog->getLocalizedUrl('ar');
if ($defaultUrl) {
echo '';
}
} else {
// Fallback to simple method if blog not found
$path = $pathWithoutLocale ? '/' . $pathWithoutLocale : '';
foreach ($locales as $locale) {
echo '';
}
// Add x-default pointing to Arabic
echo '';
}
} else {
// For non-blog pages, use the simple method
$path = $pathWithoutLocale ? '/' . $pathWithoutLocale : '';
foreach ($locales as $locale) {
echo '';
}
// Add x-default pointing to Arabic
echo '';
}
@endphp
{{-- Schema.org --}}
@endif
@php
$currentLocale = app()->getLocale();
$isRTL = in_array($currentLocale, ['ar', 'he', 'fa', 'ur']); // RTL languages
$textDirection = $isRTL ? 'rtl' : 'ltr';
@endphp
{{-- Set HTML lang and dir attributes --}}
@if ($isRTL)
{{-- RTL CSS for Arabic and other RTL languages --}}
@else
{{-- LTR CSS for English and other LTR languages --}}
@endif