34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
@props(['items' => []])
|
|
|
|
<nav class="breadcrumb" aria-label="breadcrumb">
|
|
<ol class="breadcrumb-list">
|
|
@foreach($items as $i => $it)
|
|
<li class="breadcrumb-item">
|
|
@if(!empty($it['url']) && $i < count($items)-1)
|
|
<a href="{{ $it['url'] }}" class="breadcrumb-link">{{ $it['label'] }}</a>
|
|
@else
|
|
<span class="breadcrumb-current" aria-current="page">{{ $it['label'] }}</span>
|
|
@endif
|
|
</li>
|
|
@endforeach
|
|
</ol>
|
|
</nav>
|
|
|
|
{{-- SEO: Breadcrumb JSON-LD --}}
|
|
@php
|
|
$ld = [
|
|
"@context" => "https://schema.org",
|
|
"@type" => "BreadcrumbList",
|
|
"itemListElement" => []
|
|
];
|
|
foreach($items as $idx => $it){
|
|
$ld["itemListElement"][] = [
|
|
"@type" => "ListItem",
|
|
"position" => $idx+1,
|
|
"name" => $it["label"],
|
|
"item" => $it["url"] ?? url()->current()
|
|
];
|
|
}
|
|
@endphp
|
|
<script type="application/ld+json">{!! json_encode($ld, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES) !!}</script>
|