Merge branch 'feature/seo-listing-pages' into dev

This commit is contained in:
eric.bus committed 2026-11-24 15:26:03 +01:00
commit 9d3b21359e
4 files changed
+130 -10

No files matched your search

+6 -4
View File
@@ -1,14 +1,16 @@
<head>
@include('layouts._analytics')
<title>{!! trim($__env->yieldContent('title')) !!} | GOOI&meer</title>
<title>{!! trim($__env->yieldContent('title')) !!}@if(($pageNumber ?? 1) > 1) (pagina {{ $pageNumber }})@endif | GOOI&meer</title>
<!--meta-->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.2" />
<meta name="format-detection" content="telephone=no" />
<meta name="description" content="{{ (isset($metadata) && $metadata->get('description')) ? $metadata->get('description') : 'GOOI&meer is de streekomroep voor Hilversum, Huizen, Blaricum, Eemnes en Laren.' }}" />
{{-- Allow large image previews (Google Discover, Top Stories) --}}
<meta name="robots" content="max-image-preview:large" />
<link rel="canonical" href="{{ url()->current() }}" />
{{-- Search results are kept out of the index; large image previews for the rest --}}
<meta name="robots" content="{{ !empty($noindex) ? 'noindex, follow' : 'max-image-preview:large' }}" />
{{-- Pages can set $canonical (e.g. overview pages: including ?pagina=N) --}}
<link rel="canonical" href="{{ $canonical ?? url()->current() }}" />
<!--style-->
<link href='//fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700' rel='stylesheet' type='text/css'>
@@ -32,7 +34,7 @@
<meta property="fb:app_id" content="133349980094758" />
<meta property="og:site_name" content="GOOI&meer" />
<?php if(isset($metadata)) {
$metadata->set('url', url()->current())
$metadata->set('url', $canonical ?? url()->current())
->prepend('image', $imgBase)
->prepend('audio', route('gemist.fragment'))
->append('title', ' | GOOI&meer')
+8 -1
View File
@@ -9,6 +9,12 @@
@section('page_class')
news_post post_container
@endsection
@if(!empty($listingJsonld))
@push('head')
@include('partial/listing_jsonld', ['title' => $title, 'news' => $news, 'canonical' => $canonical, 'pageNumber' => $pageNumber])
@endpush
@endif
@section('page_container_class')
{{-- 'news': same list rows as on /nieuws --}}
grey_background news
@@ -38,7 +44,8 @@
@if(count($news) >= 15)
<div>
<a class="btn auto_width" id="meer-nieuws" href="#"
{{-- The JavaScript loads more items in place; the link to the next page is for search engines --}}
<a class="btn auto_width" id="meer-nieuws" href="?pagina={{ ($pageNumber ?? 1) + 1 }}"
data-loadmorenews='{"container":["#items-more-news"]}'>
<span class="fas fa-spinner fa-spin" id="loading"></span>
LAAD MEER NIEUWSBERICHTEN
@@ -0,0 +1,51 @@
{{--
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>