Hero uit het CMS met ingebakken terugval: markers CMS:HERO-HTML, CMS:HERO-PRELOAD en CMS:DATA, hero-teksten naar nl.json, lint ook op Hero, tests en docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:48:56 +01:00
co-authored by Claude Sonnet 5.5
parent 72dd381cf9
commit 27c5ecb80f
16 changed files with 400 additions and 62 deletions
+29
View File
@@ -1,3 +1,4 @@
import { readFileSync } from 'node:fs';
import { renderToString } from 'react-dom/server';
import { describe, expect, it } from 'vitest';
import { StaticLanding } from './StaticLanding';
@@ -16,4 +17,32 @@ describe('StaticLanding (prerender)', () => {
it('does not render the dynamic contact panel', () => {
expect(html).not.toContain('data-testid="contact-panel"');
});
it('keeps the baked hero (fallback) between the two hero region placeholders', () => {
const open = html.indexOf('data-cms-marker="CMS:HERO-HTML"');
const close = html.indexOf('data-cms-marker="/CMS:HERO-HTML"');
expect(open).toBeGreaterThan(-1);
expect(close).toBeGreaterThan(open);
const region = html.slice(open, close);
expect(region).toContain('<h1');
expect(region).toContain(heroContent.lead);
expect(region).toContain('href="#pakketten"');
// The fixed code strip is outside the region: the host never replaces it.
expect(region).not.toContain(heroContent.codeLine);
expect(html.split('data-cms-marker=').length - 1).toBe(2);
});
});
describe('index.html template (host markers)', () => {
const template = readFileSync('index.html', 'utf8');
it('has the preload region and the data block marker for the CMS host', () => {
expect(template).toContain('<!--CMS:HERO-PRELOAD--><!--/CMS:HERO-PRELOAD-->');
expect(template).toMatch(/<!--CMS:DATA-->\s*<script type="application\/json" id="cms-data">\s*\{\}\s*<\/script>/);
});
it('keeps the existing offerings markers', () => {
expect(template).toContain('<!--SLP:OFFERINGS-JSON-LD-->');
expect(template).toContain('<!--SLP:OFFERINGS-HTML-->');
});
});
+4 -2
View File
@@ -13,13 +13,15 @@ import { t } from '../i18n';
* app has loaded. That avoids hydration mismatches by construction (the real app reads
* localStorage/matchMedia while rendering; this tree must not). Only components without
* window/storage/query dependencies are used here. Dynamic parts (packages, banner, contact
* form) are NOT prerendered; the packages come from the CMS host markers in index.html.
* form) are NOT prerendered; the packages come from the CMS host markers in index.html. The hero is the baked
* fallback, between the markers <!--CMS:HERO-HTML--> that scripts/prerender.mjs writes: the host replaces the
* region when the CMS has a hero (docs/hero-integration.md).
*/
export function StaticLanding() {
return (
<>
<main id="main">
<Hero />
<Hero regionMarkers />
<AboutSection />
<section id="pakketten" aria-labelledby="pakketten-heading" className="bg-surface">
<div className="mx-auto max-w-[1280px] px-6 pb-24 pt-20 sm:px-8 md:pb-[136px] md:pt-32">