diff --git a/aidlc-docs/features/asf-cms-host-injection/plan.md b/aidlc-docs/features/asf-cms-host-injection/plan.md index 180578b..96c349d 100644 --- a/aidlc-docs/features/asf-cms-host-injection/plan.md +++ b/aidlc-docs/features/asf-cms-host-injection/plan.md @@ -52,6 +52,24 @@ Why not exact copies of the styled cards: Chakra/Emotion class names and styles - **Hero (LCP):** the first slide must be in the first HTML, with the image preloaded. The host injects the slide markup and a `` into a head marker; the client slider starts from the same first slide so nothing swaps. Own plan, because the carousel is interactive. - **Gallery:** `figure` list with image URLs, sizes and alt texts in a region (crawlable), React adds lazy loading and the lightbox after hydration. Images are served same-origin by the CMS host (CSP `img-src 'self'`). +## Host contract (agreed with SMC, 2026-11-15; built after Bryan's approval) + +The host (CMS repo) finds all markers in one pass. A page with no marker and without the written production address is served unchanged as a static file. **Fail open everywhere:** a missing marker does nothing, invalid or missing data leaves the baked page as it is, an unknown slug keeps the baked fallback. + +1. **List regions** `…`, and for the banners `…` and `…`: the host replaces the content between the markers by simple crawlable HTML from the live data (C# template, everything HTML-encoded); the markers stay. No live data or a provider error keeps the baked fallback. Spec and golden files below. +2. **Data** `` directly followed by the baked ``: the host replaces the pair by the live block `{"siteUrl":"…","offerings":[…],"banners":{"top":…|null,"bottom":…|null}}` (offerings and banners exactly as the public GETs; `<`, `>`, `&`, U+2028 and U+2029 written as `\uXXXX` escapes). Without a block after the marker the live block replaces the marker. `siteUrl` is the effective public base URL (see 5), which the client needs because the JS bundle cannot be rewritten (immutable assets). +3. **JSON-LD price** `` directly before ``: the host parses the block and sets `offers.price` (whole euros, our parsing: "€ 175", "€ 1.250", "175,-") on the node that has `offers`; when the package is gone, switched off, scheduled or has no readable price, `offers` is removed from that node. A database or provider failure is different: the baked block stays (fail open). A block that is not valid JSON stays. The marker comment is removed; property order is kept. Only the shoot pages of newborn, zwangerschap and gezin get this marker; loveshoot, portret ("Prijs op aanvraag"), the overview and the home page get none. +4. **Inline value** `€ 185`: the host replaces the text by "€" + U+00A0 + whole euros; an unknown slug or an unreadable price leaves the span alone. Only simple, non-nested spans with exactly this attribute. Used in the price block of a shoot page. +5. **Own address** (`Website:AuthoredBaseUrl`): the same injector replaces the written production address in every HTML page, `sitemap.xml` and `robots.txt` by `Website:PublicBaseUrl` when that is set on the host (test: `https://test.andreaslop.nl`; production: equal or empty, nothing to replace). One artifact then serves test and production, and `VITE_SITE_URL` no longer differs per environment. The ASF build is written with `https://andreaslop.nl` (the non-www canonical origin; IIS redirects www to it). The site has no web manifest. The client takes its address from `siteUrl` in the data block (fallback: the production address), not from the bundle, so canonical and `og:` tags stay right after hydration and on navigation. +6. **Caching:** injected pages get `Cache-Control: no-cache`, a strong ETag (hash of the final body), 304 on `If-None-Match` and no Last-Modified, behind the host's 60 s cache with direct invalidation on every CMS change. `/assets/` stays immutable. Pages without markers keep the native static-file headers. + +### Neutral HTML spec (draft; golden files follow once Bryan has approved the approach) + +- Order: `displayOrder`, then the order given. Skip a package with a slug that is not `[a-z0-9-]+`, a duplicate slug, no title, a price that is not readable as whole euros above zero, or no features (same rules as `mapOfferings`). The baked fallback stays when the host has no live data at all. +- Per package: `
€ 185