{{-- Structured data (schema.org JSON-LD) for a news overview page (tag, region, theme): a CollectionPage with the articles on this page as an ItemList, and the breadcrumb. Parameters: $title, $news, $canonical, $pageNumber. --}} @php $home = rtrim(url('/'), '/') . '/'; $firstPage = strtok($canonical, '?'); // Position across pages: the articles on page N follow those of the earlier pages $offset = ($pageNumber - 1) * count($news); $items = []; foreach (array_values($news) as $i => $item) { $items[] = [ '@type' => 'ListItem', 'position' => $offset + $i + 1, 'url' => url($item->url), 'name' => $item->plainTitle(), ]; } $collection = [ '@type' => 'CollectionPage', '@id' => $canonical . '#collection', 'url' => $canonical, 'name' => $title . ' - Nieuws' . ($pageNumber > 1 ? ' (pagina ' . $pageNumber . ')' : ''), 'description' => 'Het laatste nieuws over ' . $title . ' van GOOI&meer, de streekomroep voor Gooi & Vechtstreek.', 'about' => ['@type' => 'Thing', 'name' => $title], 'inLanguage' => 'nl-NL', 'isPartOf' => ['@id' => $home . '#website'], 'publisher' => ['@id' => $home . '#organization'], 'mainEntity' => [ '@type' => 'ItemList', 'itemListOrder' => 'https://schema.org/ItemListOrderDescending', 'numberOfItems' => count($items), 'itemListElement' => $items, ], ]; $breadcrumb = [ '@type' => 'BreadcrumbList', 'itemListElement' => [ ['@type' => 'ListItem', 'position' => 1, 'name' => 'Home', 'item' => $home], ['@type' => 'ListItem', 'position' => 2, 'name' => 'Nieuws', 'item' => route('nieuws')], ['@type' => 'ListItem', 'position' => 3, 'name' => $title, 'item' => $firstPage], ], ]; $jsonld = ['@context' => 'https://schema.org', '@graph' => [$collection, $breadcrumb]]; @endphp