using Microsoft.AspNetCore.Components; namespace DeepDrftPublic.Client.Common; /// /// Environment-gated robots bridge (Phase 22 remediation ยง4). The beta/staging site is web-hosted and must /// not be crawled, so the default robots directive is environment-gated: index,follow only in /// Production, noindex,nofollow everywhere else. A per-page override /// still wins โ€” this only sets the default. /// /// /// Crawlers read the server-prerendered HTML, so correctness lives in the server prerender pass โ€” but the /// value must be identical across the InteractiveAuto double render (AC6), so the WASM pass has to resolve /// the same flag. The WASM assembly has no IWebHostEnvironment (config comes from the server). This /// mirrors the DarkMode bridge exactly: a scoped service the server seeds during prerender (from /// IWebHostEnvironment.IsProduction()) and [PersistentState] rounds to the client, so both /// passes resolve the identical value. SeoHead injects this rather than an environment dependency, /// honouring the no-environment-in-the-component constraint. /// /// public class SeoEnvironment { /// /// True only in Production. Seeded server-side and persisted across the WASM boot. Defaults to /// false so the fail-safe is "do not index" โ€” a missing bridge never accidentally opens a /// non-production site to crawlers. /// [PersistentState] public bool IsProduction { get; set; } /// The environment-gated default robots directive. Explicit page values override this. public string DefaultRobots => IsProduction ? "index,follow" : "noindex,nofollow"; }