@php // Debug and fix the availableLocales issue if (empty($availableLocales)) { $availableLocales = [ 'ar' => [ 'name' => 'Arabic', 'native' => 'العربية', 'dir' => 'rtl', ], 'en' => [ 'name' => 'English', 'native' => 'English', 'dir' => 'ltr', ], 'fr' => [ 'name' => 'French', 'native' => 'Français', 'dir' => 'ltr', ], ]; } @endphp @extends('admin.layouts.app') @section('title', __('seo_management')) @section('breadcrumb') @endsection @section('page-header')

{{ __('seo_management') }}

{{ __('manage_seo_settings_description') }}

@endsection @section('content')
@section('content')

{{ __('SEO Management') }}

{{-- Global SEO Settings Section --}}
{{ __('Global SEO Settings') }}
@foreach($availableLocales as $localeCode => $localeData) @php // Safe way to get global settings $globalSettings = null; $isConfigured = false; if ($globalSeo && $globalSeo->has($localeCode)) { $globalSettings = $globalSeo->get($localeCode)->first(); $isConfigured = $globalSettings && $globalSettings->meta_title && $globalSettings->meta_description; } @endphp
{{ $localeData['native'] }}
{{ $isConfigured ? __('Configured') : __('Not Configured') }}
@if($globalSettings)

{{ __('Meta Title') }}:
{{ Str::limit($globalSettings->meta_title, 50) ?: __('Not set') }}

{{ __('Meta Description') }}:
{{ Str::limit($globalSettings->meta_description, 80) ?: __('Not set') }}

@else

{{ __('No SEO settings found') }}

@endif {{ __('Edit') }}
@endforeach
{{-- Page-Specific SEO Section --}}
{{ __('Page SEO Settings') }}
@foreach($pageTypes as $pageType)
{{ __('Page ' . $pageType) }}
@foreach($availableLocales as $localeCode => $localeData) @php $pageSettings = null; $isConfigured = false; if ($pageSeo && $pageSeo->has($pageType) && $pageSeo->get($pageType)->has($localeCode)) { $pageSettings = $pageSeo->get($pageType)->get($localeCode)->first(); $isConfigured = $pageSettings && $pageSettings->meta_title; } @endphp
{{ $localeData['native'] }}
@endforeach
@endforeach
{{-- SEO Statistics Section --}}
{{ __('SEO Statistics') }}
{{ $globalSeo ? $globalSeo->count() : 0 }}
{{ __('Global SEO Configured') }}
{{ $pageSeo ? $pageSeo->count() : 0 }}
{{ __('Page SEO Configured') }}
{{ collect($availableLocales)->count() }}
{{ __('Supported Languages') }}
{{ round((($globalSeo ? $globalSeo->count() : 0) / (collect($availableLocales)->count() ?: 1)) * 100) }} %
{{ __('Completion Rate') }}
@endsection @push('styles') @endpush