Paginierte/gefilterte Listen: eigener Titel und Description (Page N, Kategorie)
Mit dem selbstreferenzierenden Canonical (07f74e3) zaehlten
/insights/news?page=2 und ?category=... als eigene Seiten mit dem
Titel von Seite 1 (Seobility: 3 doppelte Titel, 2x Duplicate Content).
VitecMetaHandler haengt jetzt ' - Page N' bzw. die Kategorie an Titel
und Description.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
8cdcd99eb3
commit
a9923e19e0
2 files changed
+25
-88
No files matched your search
@@ -290,6 +290,31 @@ class VitecMetaHandler extends MetaHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
// Self-canonical pages need their own title/description, otherwise
|
||||
// they count as duplicates of page 1 ("VITEC News and Articles" x3).
|
||||
if ($keep !== []) {
|
||||
$suffix = [];
|
||||
if (isset($keep['category'])) {
|
||||
$suffix[] = ucfirst(str_replace('-', ' ', $keep['category']));
|
||||
}
|
||||
if (isset($keep['page'])) {
|
||||
$suffix[] = 'Page ' . (int)$keep['page'];
|
||||
}
|
||||
$suffixText = ' – ' . implode(' – ', $suffix);
|
||||
$currentTitle = trim((string)($content['seo']['title'] ?? ''));
|
||||
if ($currentTitle !== '') {
|
||||
$content['seo']['title'] = preg_match('/^(.*?)(\s*\|\s*VITEC)$/i', $currentTitle, $m) === 1
|
||||
? $m[1] . $suffixText . $m[2]
|
||||
: $currentTitle . $suffixText;
|
||||
}
|
||||
foreach ($content['seo']['meta'] as $index => $entry) {
|
||||
if (in_array($entry['name'] ?? '', ['description', 'twitter:description'], true)
|
||||
|| ($entry['property'] ?? '') === 'og:description'
|
||||
) {
|
||||
$content['seo']['meta'][$index]['content'] = rtrim((string)$entry['content'], '. ') . $suffixText . '.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
Reference in new issue
Block a user