# Plan (proposal, not approved): the CMS host injects CMS data into the prerendered ASF pages
Status: PROPOSAL for Bryan. Nothing is built. It starts as a separate feature after the current merges (contact-form-cms, then asf-packages-cms), not through them. To be agreed with SLP Modular CMS - SMC - Main, who owns the host side.
## Why
Hosting decision (2026-11-15): the CMS host is the one entry of the website and serves the prerendered pages, `/admin` and `/api/v1/*`; IIS passes everything to it. A CMS change (packages, banners, later gallery and hero) must then be visible to search engines at once, with no rebuild. The host injects the current data into the prerendered HTML through markers (as on SLP, 60 s cache).
## What is CMS data on the pages today
Packages: the price cards (home), the shoot list and shoot blocks, the "welke shoot" choices of the contact form, the `?pakket=` check, the offer price in the JSON-LD of the shoot pages. Banners: the slim top bar and the band under the cards. See [docs/cms-integration.md](../../../docs/cms-integration.md).
## Proposal
### 1. Three kinds of markers (built into the page by the ASF build, filled by the host)
- **Data block**, one per page: `` holding the raw answers of `GET /api/v1/offerings` and both banners. The host replaces its content with the current answers (JSON-escaped: `<`, `>`, `&`, U+2028/2029). It is a non-executable block, so the CSP stays as it is and the build step that moves inline scripts treats it as data (as it does for `ld+json`).
- **Region**, for lists that differ in length (the cards, the banners): a wrapper `
` whose content is the neutral HTML. The host replaces everything between `` and `` (written into the wrapper by the build; React cannot emit comments, so the build writes them through `dangerouslySetInnerHTML`).
- **Inline value**, for a single price or name inside a sentence: `€ 185`. The host replaces the text.
- **JSON-LD price** of a shoot page: the `ld+json` block gets `data-cms-offer="newborn"`; the host sets `offers.price` from the live package (or removes `offers` when the package is gone or has no readable price).
- The same marker format as SLP, if SLP already has one (to be confirmed by SMC).
### 2. Neutral HTML in the markers
The build puts crawlable, simple semantic HTML between the markers (package name, price, features, a plain link to `/?pakket=#contact`; the banner as an `aside`), written from the baked data by one pure function (`web/src/lib/neutralHtml.ts`, all text escaped). The host produces the same markup from live data (template in C#; the ASF repo delivers the spec and golden files, SMC implements, a contract test in each repo checks both sides against the same fixtures). Light static CSS in the page makes it look acceptable (the section is below the fold).
Why not exact copies of the styled cards: Chakra/Emotion class names and styles are generated at build time, a C# template cannot reproduce them.
### 3. Hydration: read the JSON, do not fetch
- `PackagesProvider` takes its initial state from the data block (reusing `mapOfferings`, `mapBanner`, `mapTopBanner`), not from the baked import and not from a fetch after hydration. Without a block (preview, tests, a host that does not inject) it falls back to the baked data plus the live fetch it has today, so nothing is lost.
- Regions are not hydrated by React (`dangerouslySetInnerHTML` with `suppressHydrationWarning`, so React keeps the server DOM). After hydration (`useHydrated`) the styled React components render into the region and replace the neutral HTML. So the first paint is the neutral HTML, and a brief change of look follows; the cards are below the fold, and the region keeps a minimum height to avoid a layout shift.
- Inline values hydrate directly from the same data (`suppressHydrationWarning` for the formatting difference).
- The contact form choices and `?pakket=` read the same state, so they agree with what the host injected.
### 4. Hydration and contract tests (per marker, before anything ships)
- Build test: every expected marker exists exactly once per page, in the final `dist/` (after the script-moving step), and the neutral HTML equals what the pure function gives.
- E2E in real Chrome with a stand-in injector in the preview server (same algorithm as the host, fixtures with more, fewer and different packages, with and without banners, an unreadable price, a hostile text such as `