diff --git a/aidlc-docs/features/hero-module/assumptions-and-open-questions.md b/aidlc-docs/features/hero-module/assumptions-and-open-questions.md
index e42dbfb..54429a6 100644
--- a/aidlc-docs/features/hero-module/assumptions-and-open-questions.md
+++ b/aidlc-docs/features/hero-module/assumptions-and-open-questions.md
@@ -26,5 +26,5 @@ Kept while Bryan was away (2026-11-16): no questions to him, a likely assumption
| 20 | **ASF production** hosting (IIS, MijnHostingPartner): can the application pool write a data directory, and is it backed up? | Unknown; Bryan tests with ASF. The storage sits behind `IMediaStore` so a database store can follow. | Build the database store (2 to 3 days). | `IMediaStore`, `FileSystemMediaStore` |
| 21 | **SLS title** on the page. | The CMS delivers one title with line breaks; the SLP site derives the screen-reader title from the lines and adds the brand prefix itself. | Another split (a separate `heading` field) would be a model change. | `HeroSaveRequest.Title`, `HeroPictureRenderer` (`
`), SLS site |
| 22 | **Production seed**. | Not done; only the test hosts, with Bryan's password, after his go. | n/a | `scripts/Seed-Hero.ps1`, `docs/release-checklist-productie.md` section 4b |
-| 23 | What does the host write for a hero **without any slide** (SLP Software)? | A text-only region in the first HTML (so a CMS change is visible without JavaScript, LCP is the text): `h1.cms-hero-title` with an optional `span.cms-hero-tagline` and `span.cms-hero-title-lines` (title lines separated by `
`, no brand prefix), then `p.cms-hero-lead` (lead, line breaks as `
`) and `p.cms-hero-buttons` with `a.cms-hero-button`. Nothing to preload, and the preload region is left as built. A hero WITH slides but none usable stays empty (ASF unchanged). If the ASF CMS hero ever has no slides at all, ASF would get this text region instead of its baked hero. | A flag per site, or text-only only when the markers say so (for instance `CMS:HERO-TEXT`). | `HeroPictureRenderer.Render` and `TextOnlyRegion`, `HeroHtmlTransform.ApplyAsync`, `HeroTextOnlyTests` |
+| 23 | What does the host write for a hero **without any slide** (SLP Software)? | A text-only region in the first HTML (so a CMS change is visible without JavaScript, LCP is the text): `h1.cms-hero-title` with an optional `span.cms-hero-tagline` and `span.cms-hero-title-lines` (title lines separated by `
`, no brand prefix), then `p.cms-hero-lead` (lead, line breaks as `
`) and `p.cms-hero-buttons` with `a.cms-hero-button`. Nothing to preload, and the preload region is left as built. A hero WITH slides but none usable stays empty (ASF unchanged). This is a per-site switch, `Hero:TextOnlyRegion`: on in the committed settings of the SLP site, off by default (so ASF keeps its baked hero when its CMS hero has no slide, as ASF asked). | A separate marker for the text region instead of a switch. | `HeroOptions.TextOnlyRegion`, `HeroPictureRenderer.Render` and `TextOnlyRegion`, `HeroHtmlTransform.ApplyAsync`, `Api.SlpSoftware/appsettings.json`, `HeroTextOnlyTests` |
| 24 | Does the data block carry the hero when it has no slides? | Yes (intended): the site reads the hero from the data block, the baked block is `{}`. | n/a | `HeroPageModel`, `HeroDataContributor` |
diff --git a/aidlc-docs/features/hero-module/inception/requirements/site-contract-agreed-with-asf.md b/aidlc-docs/features/hero-module/inception/requirements/site-contract-agreed-with-asf.md
index 3545b7e..e43aa45 100644
--- a/aidlc-docs/features/hero-module/inception/requirements/site-contract-agreed-with-asf.md
+++ b/aidlc-docs/features/hero-module/inception/requirements/site-contract-agreed-with-asf.md
@@ -75,6 +75,6 @@ Not yet built on the ASF side (after this design): hydration and slider from the
## Text-only hero (SLP Software), added 2026-11-16
-A hero **without any slide** is written as text (SLP Software has no images; the site reads the same hero from the data block):
+A hero **without any slide** is written as text, **only on a site that asks for it** with the setting `Hero:TextOnlyRegion=true` (SLP Software: no images; it reads the same hero from the data block). The setting is off by default and off for ASF, so for ASF a hero without a slide changes nothing in the page (the baked hero stays, also in the preload region):
`
` + (tagline: `TAGLINE `) + `LINE
LINE
` + (lead: `LEAD
`, line breaks as `
`) + (buttons: `LABEL...
`, at most two). The title lines carry no brand prefix: the site adds "SLP Software:" to its own screen-reader title. There is nothing to preload, so `CMS:HERO-PRELOAD` is left as the build made it. Everything is HTML-encoded. A hero with slides of which none is usable is still empty (the ASF golden files are unchanged).
diff --git a/docs/hero-module.md b/docs/hero-module.md
index de7f934..19a106a 100644
--- a/docs/hero-module.md
+++ b/docs/hero-module.md
@@ -27,6 +27,7 @@ De admin toont alleen een badge Live of Niet live.
|---|---|
| `Media__Directory` | De map voor de afbeeldingen, **buiten de release** en buiten de webroot. Zonder deze instelling (of als de map niet beschrijfbaar is) staan uploads uit; bestaande bestanden en de publieke hero blijven werken. Niet in een committed appsettings-bestand. |
| `Media__MaxUploadBytes` (10 MB), `Media__MaxPixels` (64 miljoen), `Media__MaxParallelJobs` (2), `Media__DecodeTimeoutSeconds` (20), `Media__MaxTotalBytes` (2 GB), `Media__RetentionDays` (7) | Grenzen en bewaartijd; standaardwaarden zijn bedoeld om te blijven. |
+| `Hero__TextOnlyRegion` | `true` voor een site waarvan de hero geen afbeeldingen heeft (SLP Software; staat in de committed instellingen van die site): een hero zonder slides wordt dan als tekst (titelregels, lead, knoppen) in de eerste HTML geschreven. Uit (standaard, ook voor ASF): een hero zonder slides laat de pagina ongemoeid. |
| `Hero__MaxPublishedSlides` | Technische bovengrens op het aantal gepubliceerde slides (standaard 50). |
| `RateLimiting__HeroPublic`, `__MediaPublic`, `__HeroUpload` | Snelheidsbeleid (standaard 120 per 60 s, 600 per 60 s, 20 per uur per gebruiker). |
diff --git a/src/SlpModularCms.Api.SlpSoftware/appsettings.json b/src/SlpModularCms.Api.SlpSoftware/appsettings.json
index ab3dcd8..91631c8 100644
--- a/src/SlpModularCms.Api.SlpSoftware/appsettings.json
+++ b/src/SlpModularCms.Api.SlpSoftware/appsettings.json
@@ -9,6 +9,8 @@
}
},
"AllowedHosts": "*",
+ // The SLP hero has no images: the host writes its title, lead and buttons as text into the first HTML.
+ "Hero": { "TextOnlyRegion": true },
"Website": {
// Secure default: every response carries noindex and /robots.txt disallows all. A production
// instance must set Website__NoIndex=false and Website__PublicBaseUrl=https://slpsoftware.nl explicitly;
diff --git a/src/SlpModularCms.Api.Tests/SiteContractTests.cs b/src/SlpModularCms.Api.Tests/SiteContractTests.cs
index f4565c9..00457b8 100644
--- a/src/SlpModularCms.Api.Tests/SiteContractTests.cs
+++ b/src/SlpModularCms.Api.Tests/SiteContractTests.cs
@@ -59,6 +59,15 @@ public class SiteContractTests
(configured ?? "SpaFallback").Should().Be(mode);
}
+ [Theory]
+ [InlineData(SiteFiles.SlpSoftware, true)]
+ [InlineData(SiteFiles.AndreaSlopFotografie, false)]
+ public void TheHeroIsWrittenAsTextOnlyForTheSiteWithoutHeroImages(string site, bool textOnly)
+ {
+ // SLP Software's hero has no images, so the host writes it as text; ASF's baked hero is a picture and stays when the CMS hero has no slide.
+ SiteFiles.Committed(site).GetValue("Hero:TextOnlyRegion").Should().Be(textOnly);
+ }
+
[Theory]
[MemberData(nameof(Sites))]
public void WebsiteIsNoIndex_ByDefault(string site)
diff --git a/src/SlpModularCms.Modules.Hero.Tests/HeroTextOnlyTests.cs b/src/SlpModularCms.Modules.Hero.Tests/HeroTextOnlyTests.cs
index ecd8751..3ce3da0 100644
--- a/src/SlpModularCms.Modules.Hero.Tests/HeroTextOnlyTests.cs
+++ b/src/SlpModularCms.Modules.Hero.Tests/HeroTextOnlyTests.cs
@@ -6,7 +6,10 @@ using SlpModularCms.Modules.Hero.Services;
namespace SlpModularCms.Modules.Hero.Tests;
-/// A hero without slides (SLP Software): the host writes the title, the lead and the buttons into the first HTML.
+///
+/// A hero without slides (SLP Software): when the site asks for it (Hero:TextOnlyRegion) the host writes the
+/// title, the lead and the buttons into the first HTML; otherwise (ASF) the baked page stays.
+///
public class HeroTextOnlyTests
{
private static PublicHeroDto TextOnly(string title = "Websites,\napps\n& meer.", string? tagline = null, string? lead = "Een lead.", params HeroButtonDto[] buttons)
@@ -17,7 +20,7 @@ public class HeroTextOnlyTests
{
var hero = TextOnly(buttons: [new HeroButtonDto("Bekijk pakketten", "#pakketten"), new HeroButtonDto("Plan een gesprek", "#contact")]);
- var injection = HeroPictureRenderer.Render(hero);
+ var injection = HeroPictureRenderer.Render(hero, textOnlyRegion: true);
injection.Region.Should().Be(
"Websites,
apps
& meer.
" +
@@ -27,10 +30,19 @@ public class HeroTextOnlyTests
injection.IsEmpty.Should().BeFalse();
}
+ [Fact]
+ public void WithoutTheSiteAskingForIt_AHeroWithoutSlides_LeavesTheBakedHero()
+ {
+ var hero = TextOnly(buttons: [new HeroButtonDto("Knop", "#x")]);
+
+ HeroPictureRenderer.Render(hero).IsEmpty.Should().BeTrue();
+ HeroPictureRenderer.Render(hero, textOnlyRegion: false).IsEmpty.Should().BeTrue();
+ }
+
[Fact]
public void WithoutALead_OrButtons_ThosePartsAreLeftOut_AndATaglineComesFirst()
{
- var injection = HeroPictureRenderer.Render(TextOnly("Titel", "Label", null));
+ var injection = HeroPictureRenderer.Render(TextOnly("Titel", "Label", null), textOnlyRegion: true);
injection.Region.Should().Be("Label Titel
");
}
@@ -38,30 +50,41 @@ public class HeroTextOnlyTests
[Fact]
public void TheLead_KeepsItsLineBreaks_AndEverythingIsEncoded()
{
- var injection = HeroPictureRenderer.Render(TextOnly("x", null, "a & b\nc \"d\"", new HeroButtonDto("", "/p?a=1&b=2")));
+ var injection = HeroPictureRenderer.Render(TextOnly("x", null, "a & b\nc \"d\"", new HeroButtonDto("", "/p?a=1&b=2")), textOnlyRegion: true);
injection.Region.Should().Contain("<b>x</b>").And.Contain("a & b
c "d"").And.Contain("href=\"/p?a=1&b=2\"><i>");
injection.Region.Should().NotContain("").And.NotContain("");
}
[Fact]
- public void AHeroWithSlidesThatAreAllUnusable_StaysEmpty_AsForTheAsfSite()
+ public void AHeroWithSlidesThatAreAllUnusable_StaysEmpty_EvenWhenTheSiteAsksForText()
{
var hero = new PublicHeroDto("single", "Titel", null, null, [], [new PublicSlideDto("x", "", false, new PublicImageDto(1, 1, new FocusDto(0.5, 0.5, 1), "/m.webp", []))]);
- HeroPictureRenderer.Render(hero).IsEmpty.Should().BeTrue();
+ HeroPictureRenderer.Render(hero, textOnlyRegion: true).IsEmpty.Should().BeTrue();
}
- [Fact]
- public async Task TheTransform_FillsTheTextRegion_AndLeavesThePreloadRegionAlone()
+ private const string Page = "baked";
+
+ private static HeroHtmlTransform Transform(bool textOnly)
{
var model = Substitute.For();
model.GetAsync(default).ReturnsForAnyArgs(TextOnly());
- const string page = "baked";
+ return new HeroHtmlTransform(model, Options.Create(new HeroOptions { TextOnlyRegion = textOnly }));
+ }
- var html = await new HeroHtmlTransform(model).ApplyAsync(page, new HtmlTransformContext("https://x"), default);
+ [Fact]
+ public async Task TheTransform_FillsTheTextRegion_WhenTheSiteAsksForIt_AndLeavesThePreloadRegionAlone()
+ {
+ var html = await Transform(textOnly: true).ApplyAsync(Page, new HtmlTransformContext("https://x"), default);
html.Should().Contain("").And.NotContain("baked");
html.Should().Contain("");
}
+
+ [Fact]
+ public async Task TheTransform_LeavesTheWholePageAlone_WhenTheSiteDoesNotAskForText()
+ {
+ (await Transform(textOnly: false).ApplyAsync(Page, new HtmlTransformContext("https://x"), default)).Should().Be(Page);
+ }
}
diff --git a/src/SlpModularCms.Modules.Hero/Services/HeroInjection.cs b/src/SlpModularCms.Modules.Hero/Services/HeroInjection.cs
index 4b61714..7b02b48 100644
--- a/src/SlpModularCms.Modules.Hero/Services/HeroInjection.cs
+++ b/src/SlpModularCms.Modules.Hero/Services/HeroInjection.cs
@@ -46,7 +46,7 @@ public sealed class HeroPageModel(IPublicHeroService publicHero, IMediaStore sto
}
/// Fills the hero regions of a page: <!--CMS:HERO-HTML--> in the body and <!--CMS:HERO-PRELOAD--> in the head. Fail-open: no hero means the baked page stays.
-public sealed class HeroHtmlTransform(IHeroPageModel model) : IHtmlPageTransform
+public sealed class HeroHtmlTransform(IHeroPageModel model, Microsoft.Extensions.Options.IOptions? options = null) : IHtmlPageTransform
{
public const string HtmlRegion = "CMS:HERO-HTML";
public const string PreloadRegion = "CMS:HERO-PRELOAD";
@@ -57,7 +57,7 @@ public sealed class HeroHtmlTransform(IHeroPageModel model) : IHtmlPageTransform
public async Task ApplyAsync(string html, HtmlTransformContext context, CancellationToken cancellationToken)
{
- var rendered = HeroPictureRenderer.Render(await model.GetAsync(cancellationToken));
+ var rendered = HeroPictureRenderer.Render(await model.GetAsync(cancellationToken), options?.Value.TextOnlyRegion ?? false);
if (rendered.IsEmpty)
{
return html;
diff --git a/src/SlpModularCms.Modules.Hero/Services/HeroMapping.cs b/src/SlpModularCms.Modules.Hero/Services/HeroMapping.cs
index 8bd04cd..94023e6 100644
--- a/src/SlpModularCms.Modules.Hero/Services/HeroMapping.cs
+++ b/src/SlpModularCms.Modules.Hero/Services/HeroMapping.cs
@@ -13,6 +13,13 @@ public sealed class HeroOptions
/// carry more slides than this, so the first HTML cannot grow without bound. Everything above stays saved.
///
public int MaxPublishedSlides { get; set; } = 50;
+
+ ///
+ /// Whether a hero without any slide is written into the page as text (title lines, lead, buttons). On for a site
+ /// that has no images in its hero (SLP Software); off by default, so a site whose baked hero is a picture (ASF) keeps
+ /// that baked hero when the CMS hero has no slide (fail open).
+ ///
+ public bool TextOnlyRegion { get; set; }
}
/// Turns stored entities into the shapes of the API and the data block. Pure.
diff --git a/src/SlpModularCms.Modules.Hero/Services/HeroPictureRenderer.cs b/src/SlpModularCms.Modules.Hero/Services/HeroPictureRenderer.cs
index 22f33cf..daf929b 100644
--- a/src/SlpModularCms.Modules.Hero/Services/HeroPictureRenderer.cs
+++ b/src/SlpModularCms.Modules.Hero/Services/HeroPictureRenderer.cs
@@ -29,18 +29,19 @@ public static class HeroPictureRenderer
private const string Portrait = "(orientation: portrait)";
private const string Landscape = "(orientation: landscape)";
- public static HeroInjection Render(PublicHeroDto? hero)
+ public static HeroInjection Render(PublicHeroDto? hero, bool textOnlyRegion = false)
{
if (hero is null || string.IsNullOrWhiteSpace(hero.Title))
{
return HeroInjection.None;
}
- // A hero without any slide is a text-only hero (SLP Software): the region holds the title lines, the lead and
- // the buttons, and there is nothing to preload. A hero WITH slides of which none is usable stays empty (ASF).
+ // A hero without any slide is a text-only hero (SLP Software, when the site asks for it with
+ // Hero:TextOnlyRegion): the region holds the title lines, the lead and the buttons, and there is nothing to
+ // preload. Otherwise, and for a hero WITH slides of which none is usable, the region stays empty (ASF).
if ((hero.Slides ?? []).Count == 0)
{
- return new HeroInjection(TextOnlyRegion(hero), string.Empty);
+ return textOnlyRegion ? new HeroInjection(TextOnlyRegion(hero), string.Empty) : HeroInjection.None;
}
var slide = hero.Slides.FirstOrDefault(IsUsable);