From 78ac614d397700bb77d061d78afdaf0096f97316 Mon Sep 17 00:00:00 2001 From: Ben Schellenberger Date: Thu, 16 Apr 2026 05:23:52 -0400 Subject: [PATCH 1/4] fix(home): render index per request for git-rain host detection - Disable prerender on / so data-featured and copy match the request host. - Use lowercase hostname for git-rain matching. - Show prototype switcher only in dev, on preview hosts, or ?proto=1; hide Domain row when host already implies rain. - Style testkit/harness section borders; remove CSS-only hide for proto bar. Made-with: Cursor --- src/pages/index.astro | 52 ++++++++++++++++++++++++++++++------------- src/styles/global.css | 16 +++++++++++-- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index b824c55..2f26d18 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,4 +1,7 @@ --- +/** Per-request hostname selects featured product — must not prerender to static HTML. */ +export const prerender = false; + import BaseLayout from '../layouts/BaseLayout.astro'; import LayoutCurrent from '../components/LayoutCurrent.astro'; import LayoutA from '../components/LayoutA.astro'; @@ -6,12 +9,25 @@ import LayoutB from '../components/LayoutB.astro'; import LayoutC from '../components/LayoutC.astro'; const hostname = Astro.url.hostname; +const hostLower = hostname.toLowerCase(); const featuredParam = Astro.url.searchParams.get('featured'); const layoutParam = Astro.url.searchParams.get('layout'); +/** Dev / preview only — hide on canonical and mirror marketing domains */ +const showProtoSwitcher = + import.meta.env.DEV || + Astro.url.searchParams.get('proto') === '1' || + hostLower === 'localhost' || + hostLower.startsWith('127.') || + hostLower.endsWith('.workers.dev') || + hostLower.endsWith('.pages.dev'); + +/** Hostname already selects rain; hide Domain row so the bar is not a second “tester” */ +const showProtoDomainGroup = showProtoSwitcher && !hostLower.includes('git-rain'); + const featured: 'fire' | 'rain' = featuredParam === 'rain' ? 'rain' : featuredParam === 'fire' ? 'fire' - : hostname.includes('git-rain') ? 'rain' + : hostLower.includes('git-rain') ? 'rain' : 'fire'; const layout: 'current' | 'a' | 'b' | 'c' = layoutParam === 'a' ? 'a' @@ -39,21 +55,27 @@ function protoUrl(f: string, l: string): string { {layout === 'c' && } {layout === 'current' && } -
-
- Domain - fire.* - rain.* -
-
-
- Layout - now - A - B - C + {showProtoSwitcher && ( +
+ {showProtoDomainGroup && ( + <> +
+ Domain + fire.* + rain.* +
+ + + )} +
+ Layout + now + A + B + C +
-
+ )}