Historie-Hero: Originaltext + Original-Hero-Bild der alten Seite (img-Komponente um Einzeldatei-Modus erweitert)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 22:53:34 +02:00
parent efa47d4f60
commit ee4dad2a5f
3 changed files with 17 additions and 13 deletions

View File

@@ -3,8 +3,9 @@
declare(strict_types=1); declare(strict_types=1);
/** /**
* Responsives Bild aus Varianten-Set. Props: * Responsives Bild aus Varianten-Set ODER Einzeldatei. Props:
* $image array{base: string, widths: int[], alt: string} — base relativ zu assets/, Dateien: <base>-<w>.jpg * $image array{base: string, widths: int[], alt: string} — Varianten <base>-<w>.jpg
* ODER array{src: string, width: int, height: int, alt: string} — Originaldatei 1:1
* $sizes string (optional, default '100vw') * $sizes string (optional, default '100vw')
* $eager bool (optional) — above the fold: eager + fetchpriority high * $eager bool (optional) — above the fold: eager + fetchpriority high
* $class string (optional) * $class string (optional)
@@ -13,6 +14,14 @@ $sizes = $sizes ?? '100vw';
$eager = $eager ?? false; $eager = $eager ?? false;
$class = $class ?? ''; $class = $class ?? '';
if (!empty($image['src'])): ?>
<img<?= $class !== '' ? ' class="' . e($class) . '"' : '' ?>
src="<?= e(asset($image['src'])) ?>"
alt="<?= e($image['alt']) ?>"
width="<?= e($image['width']) ?>" height="<?= e($image['height']) ?>"
<?= $eager ? 'loading="eager" fetchpriority="high"' : 'loading="lazy" decoding="async"' ?>>
<?php return; endif;
$widths = $image['widths']; $widths = $image['widths'];
$largest = max($widths); $largest = max($widths);
$srcset = implode(', ', array_map( $srcset = implode(', ', array_map(

View File

@@ -15,9 +15,4 @@ $meta = [
]; ];
component('hero', ['hero' => $historie['hero']]); component('hero', ['hero' => $historie['hero']]);
?>
<div class="container section--slim">
<p class="timeline-intro"><?= e($historie['intro']) ?></p>
</div>
<?php
component('timeline', ['events' => $historie['events']]); component('timeline', ['events' => $historie['events']]);

View File

@@ -2,15 +2,15 @@
"hero": { "hero": {
"align": "center", "align": "center",
"compact": true, "compact": true,
"title": "Vereinshistorie", "title": "Historie",
"tagline": "Der Katzbachtaler Weg seit 1908", "text": "Wir sind seit über 100 Jahren dein Sportverein in der Kulmbacher Region. Erlebe unsere einzigartige Geschichte und die Entstehung der Hans-Rausch-Sportanlage.",
"image": { "image": {
"base": "img/pages/vereinsgelaende", "src": "img/historie/1972-sportheim.jpg",
"widths": [1000, 1600], "width": 519,
"alt": "Luftaufnahme der Hans-Rausch-Sportanlage im Katzbachtal" "height": 272,
"alt": "Einweihung des Sportheims im Katzbachtal 1972"
} }
}, },
"intro": "Erlebe die bewegte Geschichte des TSV 08 Kulmbach von den ersten Spielen an der Bayreuther Straße bis zur Hans-Rausch-Sportanlage im Katzbachtal.",
"events": [ "events": [
{ {
"year": "1947", "year": "1947",