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
+12 -1
View File
@@ -20,7 +20,18 @@ await build({
});
const { render } = await import(pathToFileURL(path.join(ssrDir, 'entry-server.mjs')).href);
const markup = render();
// The hero marks the region the CMS host may replace; React cannot write comments, so the component renders
// <i data-cms-marker="CMS:HERO-HTML"> placeholders that become <!--CMS:HERO-HTML--> here. Without a host they are
// plain comments and nothing changes for the visitor.
const markerPattern = /<i\s[^>]*data-cms-marker="([^"]+)"[^>]*><\/i>/g;
const rendered = render();
const markup = rendered.replace(markerPattern, (_all, name) => `<!--${name}-->`);
const expectedMarkers = ['<!--CMS:HERO-HTML-->', '<!--/CMS:HERO-HTML-->'];
for (const marker of expectedMarkers) {
if (markup.split(marker).length !== 2 || /data-cms-marker/.test(markup)) {
throw new Error(`prerender: expected exactly one ${marker} in the static landing`);
}
}
const html = await readFile(htmlPath, 'utf8');
const placeholder = '<div id="root"></div>';