- Canonical URL includes ?pagina=N, so later pages aren't treated as
duplicates of page 1; 'load more' button links to the next page so
search engines can reach older articles (JavaScript still loads in place)
- Description per page ('Het laatste nieuws over Blaricum van GOOI&meer...')
and '(pagina N)' in the title from page 2
- Real tag name in title/heading ('Gooise Meren' instead of 'Gooise-meren')
- CollectionPage + ItemList (articles, numbered across pages) and
BreadcrumbList structured data
- Open Graph tags (type website, title, description, url, image)
- Search results: noindex, follow and no structured data
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
2.1 KiB
PHP
52 lines
2.1 KiB
PHP
{{--
|
|
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
|
|
<script type="application/ld+json">{!! json_encode($jsonld, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_PRETTY_PRINT) !!}</script>
|