laravel-6 support
This commit is contained in:
23
vendor/davejamesmiller/laravel-breadcrumbs/views/json-ld.php
vendored
Normal file
23
vendor/davejamesmiller/laravel-breadcrumbs/views/json-ld.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
||||
$json = [
|
||||
'@context' => 'http://schema.org',
|
||||
'@type' => 'BreadcrumbList',
|
||||
'itemListElement' => [],
|
||||
];
|
||||
|
||||
foreach ($breadcrumbs as $i => $breadcrumb) {
|
||||
$json['itemListElement'][] = [
|
||||
'@type' => 'ListItem',
|
||||
'position' => $i + 1,
|
||||
'item' => [
|
||||
'@id' => $breadcrumb->url ?: Request::fullUrl(),
|
||||
'name' => $breadcrumb->title,
|
||||
'image' => $breadcrumb->image ?? null,
|
||||
],
|
||||
];
|
||||
}
|
||||
?>
|
||||
<script type="application/ld+json"><?= json_encode($json) ?></script>
|
Reference in New Issue
Block a user