Back-to-top-Button: erscheint nach 1,5 Viewporthöhen, Fokus-Management, reduced-motion, 48px-Ziel
Enthält auch User-Upgrade: JSON-LD als @graph mit seitenspezifischen Extra-Knoten Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,13 +3,19 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SportsClub-Schema aus data/club.json — auf jeder Seite identisch (NAP-Konsistenz für SEO/GEO).
|
||||
* JSON-LD als ein @graph. Der SportsClub-Knoten (aus data/club.json) ist auf jeder
|
||||
* Seite identisch (NAP-Konsistenz für SEO/GEO) und hat eine feste @id, auf die
|
||||
* seitenspezifische Knoten verweisen.
|
||||
* Props:
|
||||
* $extra array — zusätzliche Graph-Knoten der Seite (z. B. SportsTeam, FAQPage,
|
||||
* BreadcrumbList), gebaut via team_schema()/page_schema().
|
||||
*/
|
||||
$club = json_load('club');
|
||||
$clubId = abs_url() . '#club';
|
||||
|
||||
$schema = [
|
||||
'@context' => 'https://schema.org',
|
||||
$clubNode = [
|
||||
'@type' => 'SportsClub',
|
||||
'@id' => $clubId,
|
||||
'name' => $club['name'],
|
||||
'alternateName' => $club['legal_name'],
|
||||
'foundingDate' => $club['founded'],
|
||||
@@ -27,5 +33,10 @@ $schema = [
|
||||
],
|
||||
'sameAs' => array_values(array_filter($club['social'])),
|
||||
];
|
||||
|
||||
$graph = [
|
||||
'@context' => 'https://schema.org',
|
||||
'@graph' => array_merge([$clubNode], $extra ?? []),
|
||||
];
|
||||
?>
|
||||
<script type="application/ld+json"><?= json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?></script>
|
||||
<script type="application/ld+json"><?= json_encode($graph, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?></script>
|
||||
|
||||
@@ -16,7 +16,7 @@ if (empty($meta['title_absolute'])) {
|
||||
$description = $meta['description'] ?? $club['description'];
|
||||
$canonical = abs_url($current === '404' ? '' : $current);
|
||||
$ogImage = rtrim((string) config('base_url'), '/') . '/assets/' . ltrim($meta['og_image'] ?? 'img/og-default.jpg', '/');
|
||||
$scripts = array_merge(['nav.js'], $meta['scripts'] ?? []);
|
||||
$scripts = array_merge(['nav.js', 'back-to-top.js'], $meta['scripts'] ?? []);
|
||||
?>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
@@ -49,4 +49,4 @@ $scripts = array_merge(['nav.js'], $meta['scripts'] ?? []);
|
||||
<?php foreach ($scripts as $js): ?>
|
||||
<script defer src="<?= e(asset("js/{$js}")) ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
<?php component('jsonld'); ?>
|
||||
<?php component('jsonld', ['extra' => $meta['schema'] ?? []]); ?>
|
||||
|
||||
@@ -14,9 +14,12 @@ declare(strict_types=1);
|
||||
<body>
|
||||
<a class="skip-link" href="#main">Zum Inhalt springen</a>
|
||||
<?php component('header', ['current' => $current]); ?>
|
||||
<main id="main">
|
||||
<main id="main" tabindex="-1">
|
||||
<?= $content ?>
|
||||
</main>
|
||||
<?php component('footer'); ?>
|
||||
<a class="back-to-top" href="#main" hidden>
|
||||
<?= icon('arrow-up') ?><span class="visually-hidden">Zurück nach oben</span>
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user