@if (!empty($items)) @php $breadcrumbSchemaItems = collect($items) ->values() ->map(function ($item, $index) { if (!is_array($item)) { return null; } $label = trim((string) ($item['label'] ?? '')); if ($label === '') { return null; } $url = !empty($item['url']) ? (string) $item['url'] : url()->current(); return [ '@type' => 'ListItem', 'position' => $index + 1, 'name' => $label, 'item' => $url, ]; }) ->filter() ->values() ->all(); $breadcrumbSchema = [ '@context' => 'https://schema.org', '@type' => 'BreadcrumbList', 'itemListElement' => $breadcrumbSchemaItems, ]; @endphp @if (!empty($breadcrumbSchemaItems)) @endif @endif