Add minimalist editable CMS content section

This commit is contained in:
2026-03-24 15:57:37 +01:00
parent 8170ce7ece
commit 3378427e07
4 changed files with 185 additions and 34 deletions
+20 -30
View File
@@ -54,6 +54,8 @@ $copy = [
$t = $copy[$lang];
$allRecipes = load_recipes();
$siteSettings = load_site_settings();
$cms = $siteSettings['cms'][$lang] ?? [];
$localizedAll = localize_recipes($allRecipes, $lang);
$recipes = filter_recipes($allRecipes, $q ?: null, $tag ?: null, $lang);
$recipes = array_values(array_filter($recipes, fn($r) => empty($r['coming_soon']))); // hide coming soon from main list
@@ -84,24 +86,18 @@ foreach ($localizedAll as $recipe) {
}
$allTags = array_values(array_unique($allTags));
$comingFeatures = $lang === 'de'
? [
'Nährwerte & Rezepte Vorschlag individuell angepasst auf Ernährungsziel',
'Einkaufsliste ans Handy senden',
'Step-by-Step Rezepte Assistent mit Videos',
]
: [
'Nutrition info & recipe suggestions tailored to your goals',
'Send your grocery list straight to your phone',
'Step-by-step recipe assistant with videos',
];
$comingFeatures = array_values(array_filter([
trim((string) ($cms['coming_feature_1'] ?? '')),
trim((string) ($cms['coming_feature_2'] ?? '')),
trim((string) ($cms['coming_feature_3'] ?? '')),
], 'strlen'));
$pageTitle = $lang === 'de'
$pageTitle = trim((string) ($cms['home_title'] ?? '')) ?: ($lang === 'de'
? 'FlixCooks | Moderner Foodblog für schnelle Alltagsküche'
: 'FlixCooks | Modern food blog for busy home cooks';
$description = $lang === 'de'
: 'FlixCooks | Modern food blog for busy home cooks');
$description = trim((string) ($cms['home_description'] ?? '')) ?: ($lang === 'de'
? 'Frische, schnelle Rezepte mit klaren Schritten und großem Geschmack. Gebaut für Hetzner Webhosting in einfachem PHP.'
: 'Fresh, fast recipes with clear steps, smart prep notes, and big flavor. Built for Hetzner web hosting in plain PHP.';
: 'Fresh, fast recipes with clear steps, smart prep notes, and big flavor. Built for Hetzner web hosting in plain PHP.');
$langSwitchLabel = $lang === 'de' ? 'DE' : 'EN';
$langSwitchHref = lang_url($lang === 'de' ? 'en' : 'de');
$navHome = $t['home'];
@@ -183,24 +179,18 @@ include __DIR__ . '/partials/head.php';
</div>
<div class="landing__copy">
<p class="landing__eyebrow">
<?php echo $lang === 'de'
? 'Saisonal &nbsp;·&nbsp; Unkompliziert &nbsp;·&nbsp; Richtig lecker'
: 'Seasonal &nbsp;·&nbsp; Unfussy &nbsp;·&nbsp; Ridiculously tasty'; ?>
<?php echo e($cms['landing_eyebrow'] ?? ($lang === 'de'
? 'Saisonal · Unkompliziert · Richtig lecker'
: 'Seasonal · Unfussy · Ridiculously tasty')); ?>
</p>
<h1 class="landing__headline">
<?php if ($lang === 'de'): ?>
<span class="line line--1">Besser&nbsp;<em>kochen</em></span>
<span class="line line--2">unter der Woche.</span>
<span class="line line--3">Glänzen&nbsp;<em>am Wochenende.</em></span>
<?php else: ?>
<span class="line line--1">Cook&nbsp;<em>better</em></span>
<span class="line line--2">weeknights.</span>
<span class="line line--3">Brighter&nbsp;<em>weekends.</em></span>
<?php endif; ?>
<span class="line line--1"><?php echo e($cms['landing_line_1'] ?? ($lang === 'de' ? 'Besser kochen' : 'Cook better')); ?></span>
<span class="line line--2"><?php echo e($cms['landing_line_2'] ?? ($lang === 'de' ? 'unter der Woche.' : 'weeknights.')); ?></span>
<span class="line line--3"><?php echo e($cms['landing_line_3'] ?? ($lang === 'de' ? 'Glänzen am Wochenende.' : 'Brighter weekends.')); ?></span>
</h1>
<p class="landing__sub"><?php echo e($t['subhead']); ?></p>
<a href="#recipes-start" class="landing__cta" id="landingCta">
<span><?php echo $lang === 'de' ? 'Rezepte entdecken' : 'Explore recipes'; ?></span>
<span><?php echo e($cms['landing_cta'] ?? ($lang === 'de' ? 'Rezepte entdecken' : 'Explore recipes')); ?></span>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
</a>
</div>
@@ -221,8 +211,8 @@ document.getElementById('landingCta').addEventListener('click', function(e){
<?php if (!empty($comingSoon)): ?>
<div class="coming-strip" aria-label="Coming soon recipes">
<div class="coming-strip__head">
<p class="pill pill--ghost"><?php echo e($lang === 'de' ? 'Bald verfügbar' : 'Coming soon'); ?></p>
<small><?php echo count($comingSoon); ?> <?php echo $lang === 'de' ? 'in Arbeit' : 'in progress'; ?></small>
<p class="pill pill--ghost"><?php echo e($cms['coming_soon_badge'] ?? ($lang === 'de' ? 'Bald verfügbar' : 'Coming soon')); ?></p>
<small><?php echo count($comingSoon); ?> <?php echo e($cms['coming_soon_suffix'] ?? ($lang === 'de' ? 'in Arbeit' : 'in progress')); ?></small>
</div>
<div class="coming-strip__row">
<?php foreach (array_slice($comingSoonDisplay, 0, 5) as $cs): ?>