diff --git a/aidlc-docs/features/asf-host-injection/plan.md b/aidlc-docs/features/asf-host-injection/plan.md index c5d56f7..14697da 100644 --- a/aidlc-docs/features/asf-host-injection/plan.md +++ b/aidlc-docs/features/asf-host-injection/plan.md @@ -2,7 +2,7 @@ - **Slug**: asf-host-injection - **Type**: Feature, **proposal; not approved, build not started** -- **Status**: Plan agreed with the ASF session (their counterpart: `AndreaSlopFotografie-packages/aidlc-docs/features/asf-cms-host-injection/plan.md`, section "Host contract"). Bryan accepted the approach (neutral list first, styled cards after hydration; the host writes the list HTML) on 2026-11-15 but said **not to start building yet**: he first reads the plan and finds out whether .NET 10 can run on the hosting package (hosting bundle or self-contained). +- **Status**: **Built** on `feature/contact-forms-module` (commits 7d66944, a136615, ef4fb9d, 4baadf3 and the one after it; tests green locally), **not yet deployed**: needs the website build with the markers and `Website__PublicBaseUrl=https://test.andreaslop.nl` in the ASF-test env file. Before: plan agreed with the ASF session (their counterpart: `AndreaSlopFotografie-packages/aidlc-docs/features/asf-cms-host-injection/plan.md`, section "Host contract"). Bryan accepted the approach (neutral list first, styled cards after hydration; the host writes the list HTML) on 2026-11-15 but said **not to start building yet**: he first reads the plan and finds out whether .NET 10 can run on the hosting package (hosting bundle or self-contained). - **Affected components (planned)**: `SlpModularCms.Core` (`Hosting/Website`: generalise `IndexHtmlInjector`, hook in `PrerenderedSiteMiddleware`), `SlpModularCms.Modules.Offerings` (marker providers), `scripts/smoke-site.sh`, docs - **Documented**: 2026-11-15 - **Documentation Language**: English @@ -42,3 +42,20 @@ Injected pages: `Cache-Control: no-cache`, strong ETag from the final body, 304 ## Risks Markers stripped by a build (confirmed not the case for ASF's Vite/TanStack prerender); proxy or IIS caching of HTML; .NET 10 unavailable on the package; the per-base-URL cache keyed from the Host header when no `PublicBaseUrl` is configured (to be capped in this unit); several app instances (invalidation is per process; the 60-second TTL bounds the lag). Estimated effort: about 1.5 days for the host side, plus ASF's front-end rework. + +## As built (2026-11-15) + +| Piece | Where | +|---|---| +| Marker edits (regions, data block, JSON-LD, inline values, script escaping) | `Core/Hosting/Website/HtmlMarkerEditor.cs` | +| Injector for every html/xml/txt file of the prerendered host and for the SpaFallback index.html; caching (60 s, direct invalidation, capped at 256 entries), ETag/304, address replacement, per-part fail-open | `Core/Hosting/Website/HtmlMarkerInjector.cs`; hook in `PrerenderedSiteMiddleware` (`ServeFile`); registered by `AddCmsWebsite` | +| Neutral list and banner HTML, price rules (whole euros, `1.250`) | `Offerings/Services/CmsPageHtml.cs`; golden files of the website repo (ASF commit 16027f5) in `Offerings.Tests/Golden/host-injection`, `GoldenHtmlTests` | +| Marker transform (regions, `#cms-data` with `siteUrl`, JSON-LD price, `data-cms-price`) | `Offerings/Services/OfferingsHtmlTransform.cs` (`IHtmlPageTransform`) | +| Settings | ASF `appsettings.json`: `Website:AuthoredBaseUrl=https://andreaslop.nl`, `Website:PublicBaseUrl` empty (env `Website__PublicBaseUrl`) | +| End-to-end test (real database, ASF settings, temporary web root) | `Api.Tests/AsfInjectionPipelineTests` | +| Smoke test | `scripts/smoke-site.sh`: unprocessed `CMS:DATA` / `CMS:OFFER-JSON-LD` markers on `/` fail; a data block must carry this host's `siteUrl`; ETag and no-cache on the injected home page | + +Behaviour choices: a successful empty answer empties a region (no live package, no active banner); a failing service leaves the baked content; a package without a derivable price removes `offers` from the JSON-LD (a failing service does not); a file without markers and without the authored address stays a plain static file; 404.html is not injected. + +**Deploy order matters**: set `Website__PublicBaseUrl=https://test.andreaslop.nl` on ASF-test before the first website build with markers is deployed, otherwise the data block's `siteUrl` is the production address and the smoke test fails on purpose. + diff --git a/aidlc-docs/features/website-seo/overview.md b/aidlc-docs/features/website-seo/overview.md index 9a42dc5..a449a8b 100644 --- a/aidlc-docs/features/website-seo/overview.md +++ b/aidlc-docs/features/website-seo/overview.md @@ -24,6 +24,6 @@ Only hosts in `WebsiteMode.SpaFallback` (SlpSoftware). The ASF host (`Prerendere | `KnownPaths` | Only these paths are pages (200, the SPA shell); any other website path is a real 404 (still the shell). `/api`, `/admin` and assets keep working. | | `Sitemap:Paths` | Paths listed in the sitemap. | -## Index markers (`IndexHtmlInjector`) +## Index markers (`HtmlMarkerInjector` (until 2026-11-15 `IndexHtmlInjector`; generalised for the prerendered host, see asf-host-injection)) The host fills markers in `index.html`: `` (schema.org `ItemList` of `Offer`) and `` (a static `#packages-static` list), rendered by `OfferingsIndexMarkers` from the live offerings. 60-second cache, invalidated directly by every offering change, `ETag` with 304 support; if a provider fails the plain page is still served. The markers must stay in `
` above `#root`; the website removes `#packages-static` on start-up. diff --git a/scripts/smoke-site.sh b/scripts/smoke-site.sh index ffb08c0..cb32ef9 100644 --- a/scripts/smoke-site.sh +++ b/scripts/smoke-site.sh @@ -54,6 +54,25 @@ expect_status /api/v1/offerings/all 401 "the administrator list is protected" expect_header / X-Robots-Tag noindex "noindex on the website" expect_body /robots.txt "Disallow: /" "robots.txt disallows everything" +# The home page is served by the host. When the website build left CMS markers in it, the host must have processed +# them: an unprocessed or JSON-LD marker means the page does not go through the injector (a proxy or +# IIS serving files itself, or a host without the injection), and a deployed data block must carry this host's address. +home="$(curl_get "$base/" || true)" +if printf '%s' "$home" | grep -qE '" + + "" + + "baked top" + + "baked list" + + "vanaf € 1