Files
validation-lab-site/src/layouts/Site.astro
T
Keith f1d30ef1b6 Marketing round: pilot banner + price feedback, simpler lead forms, journey page, trimmed home
- pricing: pilot-stage banner (pilot_label/pilot_text) on home + founders;
  price-range checklist on the founders page — selections fire consent-gated
  Umami events (price-range-*) via the new data-umami-event listener and ride
  the Zoho payload as price_range
- forms: Zoho needs only name + email — founders form drops first/last split,
  stage, sector, country, heard; hubs form drops country/programme select
  (country deduced downstream from locale, which already rides the payload)
- journey: moved to its own /journey/ page (six phases), nav entry added
- home: reduced to hero + pilot banner + two audience cards linking to the
  value-proposition pages; verbose blocks rewritten
- nav bug fix: the nav was built from the CURRENT page's alternates, so every
  page rendered a one-entry nav; now built from all pages of the locale
- CMS: config.yml + custom preview gain the pilot banner, price checklist and
  card-link fields
2026-11-22 09:13:40 +01:00

622 lines
21 KiB
Plaintext

---
// Shared layout for every page. Markdown pages hand their frontmatter to
// the layout as `frontmatter`; structured blocks (hero, cards, journey,
// capabilities) render from frontmatter fields, long-form prose rides the
// body slot. Locale derives from the URL's first segment (subdirectory
// scheme: base English at root, every other locale under /<code>/…).
import LeadForm from "../components/LeadForm.astro";
import { DEFAULT_LOCALE, LOCALES, localeByCode } from "../i18n/locales.js";
import site from "../data/site.json";
const stringsModules = import.meta.glob("../i18n/*.json", { eager: true });
const pageModules = import.meta.glob("../pages/**/*.md", { eager: true });
const segments = Astro.url.pathname.split("/").filter(Boolean);
const maybeLocale = localeByCode(segments[0] ?? "");
const locale = maybeLocale ? maybeLocale.code : DEFAULT_LOCALE;
const dir = maybeLocale?.rtl ? "rtl" : "ltr";
const strings = (stringsModules[`../i18n/${locale}.json`] ?? stringsModules[`../i18n/${DEFAULT_LOCALE}.json`]).default ?? {};
// pageId is the path with the locale prefix and trailing index stripped —
// the key that joins the hreflang alternates across languages.
const rest = maybeLocale ? segments.slice(1) : segments;
const pageId =
rest.length === 0 || (rest.length === 1 && rest[0] === "index")
? ""
: rest[0].replace(/\.html$/, "");
const baseUrl = site.base_url;
const localePrefix = (code) => (code === DEFAULT_LOCALE ? "" : `/${code}`);
const pageUrl = (code, id) => `${baseUrl}${localePrefix(code)}${id === "" ? "/" : `/${id}/`}`;
// hreflang alternates: only the locales that actually carry this page.
// localePages: every page that exists in the nav's scope — parsed once,
// shared by the language switcher (same page, all locales) and the nav
// (all pages, this locale).
const parsePages = () =>
Object.keys(pageModules)
.map((file) => {
const m = file.match(/\.\.\/pages\/(?:([^/]+)\/)?([^/]+)\.md$/);
if (!m) return null;
const [, code, name] = m;
return { code: code ?? DEFAULT_LOCALE, id: name === "index" ? "" : name };
})
.filter((v) => v && (localeByCode(v.code) || v.code === DEFAULT_LOCALE));
const alternates = parsePages().filter((v) => v.id === pageId);
const canonical = `${baseUrl}${Astro.url.pathname}`;
const fm = Astro.props.frontmatter ?? {};
const description = fm.description ?? strings.footer_tagline;
const ogImage = fm.og_image; // optional; pages may override
// nav: this locale's pages only, ordered by the fixed page order.
const order = ["", "journey", "for-founders", "for-innovation-hubs", "privacy", "cookies"];
const navEntries = parsePages()
.filter((a) => a.code === locale && order.includes(a.id))
.map((a) => ({
id: a.id,
href: `${localePrefix(locale)}${a.id === "" ? "/" : `/${a.id}/`}`,
label:
a.id === "" ? strings.nav_home
: a.id === "journey" ? strings.nav_journey
: a.id === "for-founders" ? strings.nav_for_founders
: a.id === "for-innovation-hubs" ? strings.nav_for_innovation_hubs
: a.id === "privacy" ? strings.nav_privacy
: strings.nav_cookies,
}))
.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));
const isAudiencePage = pageId === "for-founders" || pageId === "for-innovation-hubs";
const jsonLd =
pageId === ""
? {
"@context": "https://schema.org",
"@type": "Organization",
name: site.brand,
url: baseUrl,
description,
}
: isAudiencePage
? {
"@context": "https://schema.org",
"@type": "Service",
serviceType: pageId === "for-founders" ? "Startup validation guidance" : "Innovation hub programmes",
provider: { "@type": "Organization", name: site.brand, url: baseUrl },
areaServed: "EU",
url: canonical,
description,
}
: {
"@context": "https://schema.org",
"@type": "WebPage",
name: fm.title,
url: canonical,
description,
};
const hasForm = isAudiencePage;
---
<!doctype html>
<html lang={locale} dir={dir}>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>{fm.title}</title>
<meta name="description" content={description} />
<link rel="canonical" href={canonical} />
{alternates.map((a) => (
<link rel="alternate" hreflang={a.code} href={pageUrl(a.code, a.id)} />
))}
<link rel="alternate" hreflang="x-default" href={pageUrl(DEFAULT_LOCALE, pageId)} />
{ogImage && <meta property="og:image" content={`${baseUrl}${ogImage}`} />}
<meta property="og:title" content={fm.title} />
<meta property="og:description" content={description} />
<meta property="og:url" content={canonical} />
<meta property="og:type" content="website" />
<meta property="og:locale" content={locale} />
<meta name="twitter:card" content="summary" />
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
<script
is:inline
set:html={`(() => {
// Cookie-gated analytics: nothing loads until the visitor opts in,
// and the choice is remembered in localStorage. The banner lives at
// the END of <body> while this script runs in <head> — attach on
// DOMContentLoaded, not at parse time (found live 2026-11-21: the
// banner never dismissed because it did not exist yet on lookup).
const KEY = "vl-consent";
const STATS_URL = ${JSON.stringify(site.stats_script_url)};
const STATS_ID = ${JSON.stringify(site.stats_website_id)};
const injectStats = () => {
if (STATS_URL.indexOf("REPLACE_") === 0 || document.getElementById("vl-stats")) return;
const s = document.createElement("script");
s.id = "vl-stats";
s.defer = true;
s.src = STATS_URL + "";
s.setAttribute("data-website-id", STATS_ID);
document.head.appendChild(s);
};
const decide = (allow) => {
try { localStorage.setItem(KEY, allow ? "granted" : "denied"); } catch {}
document.getElementById("cookie-consent")?.remove();
if (allow) injectStats();
};
const init = () => {
const banner = document.getElementById("cookie-consent");
if (!banner) return;
banner.addEventListener("click", (event) => {
const b = event.target.closest("button");
if (!b) return;
decide(b.dataset.answer === "yes");
});
let stored = null;
try { stored = localStorage.getItem(KEY); } catch {}
if (stored) {
banner.remove();
if (stored === "granted") injectStats();
}
};
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();`}
/>
</head>
<body>
<header class="site-header">
<nav>
<a class="brand" href={`${localePrefix(locale)}/`}>
<svg class="brand-mark" viewBox="0 0 32 32" aria-hidden="true">
<defs>
<linearGradient id="vl-mark" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#3a55d9" />
<stop offset="1" stop-color="#8757d8" />
</linearGradient>
</defs>
<rect width="32" height="32" rx="8" fill="url(#vl-mark)" />
<path
d="M8.5 20.5c1.4-9.6 6.6-10.7 7-10.7 2.3 0-1.6 8.6 1.2 8.6 1.7 0 3.9-4.5 6.8-6.9"
fill="none"
stroke="#fff"
stroke-width="2.4"
stroke-linecap="round"
/>
</svg>
<span>{site.brand}</span>
</a>
{navEntries.map((p) => (
<a href={p.href} aria-current={Astro.url.pathname === p.href ? "page" : undefined}>{p.label}</a>
))}
<label class="switcher">
<span aria-hidden="true">{strings.switcher_label}</span>
<select
aria-label={strings.lang_label}
onchange={`const u=new URL(this.value, location.origin); location.href = u.href;`}
>
{alternates.map((a) => (
<option value={pageUrl(a.code, a.id)} selected={a.code === locale}>
{localeByCode(a.code)?.name ?? a.code}
</option>
))}
</select>
</label>
</nav>
</header>
<main>
{
fm.hero_headline && (
<section class="hero">
<h1>{fm.hero_headline}</h1>
{fm.hero_sub && <p class="hero-sub">{fm.hero_sub}</p>}
{
(fm.cta_founders || fm.cta_hubs) && (
<p class="cta-row">
{fm.cta_founders && <a class="button" href={`${localePrefix(locale)}/for-founders/`}>{fm.cta_founders}</a>}
{fm.cta_hubs && <a class="button button-secondary" href={`${localePrefix(locale)}/for-innovation-hubs/`}>{fm.cta_hubs}</a>}
</p>
)
}
</section>
)
}
{
fm.pilot_text && (
<aside class="pilot-banner">
{fm.pilot_label && <strong class="pilot-label">{fm.pilot_label}</strong>}
<p>{fm.pilot_text}</p>
</aside>
)
}
{
Array.isArray(fm.value_props) && fm.value_props.length > 0 && (
<section class="cards-section">
{fm.value_props_title && <h2>{fm.value_props_title}</h2>}
<div class="cards">
{fm.value_props.map((v) => (
<article class="card">
<h3>{v.heading}</h3>
<p>{v.text}</p>
{v.link && (
<a class="card-link" href={`${localePrefix(locale)}${v.link}`}>{v.link_label ?? strings.card_link_default}</a>
)}
</article>
))}
</div>
</section>
)
}
{
Array.isArray(fm.price_ranges) && fm.price_ranges.length > 0 && (
<section class="pricing">
<h2>{fm.price_title}</h2>
{fm.price_note && <p class="pricing-note">{fm.price_note}</p>}
<div class="cards price-list">
{fm.price_ranges.map((r) => (
<label class="card cap" data-umami-event={`price-range-${r.key}`}>
<input
type="checkbox"
data-price={r.key}
data-price-label={r.label}
/>
<span class="cap-body">
<strong>{r.label}</strong>
</span>
</label>
))}
</div>
</section>
)
}
{
Array.isArray(fm.journey) && fm.journey.length > 0 && (
<section class="journey">
<h2>{strings?.journey_title ?? fm.journey_title ?? "The journey"}</h2>
{fm.journey_note && <p class="journey-note">{fm.journey_note}</p>}
<ol>
{fm.journey.map((step, i) => (
<li value={i + 1}><strong>{step.title}</strong>{step.text && <span> — {step.text}</span>}</li>
))}
</ol>
</section>
)
}
{
Array.isArray(fm.capabilities) && fm.capabilities.length > 0 && (
<section class="capabilities">
<h2>{fm.capabilities_title}</h2>
{fm.capabilities_note && <p class="capabilities-note">{fm.capabilities_note}</p>}
<div class="cards cap-list">
{fm.capabilities.map((c) => (
<label class="card cap" data-umami-event={`capability-${c.key}`}>
<input
id={`cap-${c.key}`}
type="checkbox"
data-cap={c.key}
data-cap-label={c.heading}
/>
<span class="cap-body">
<strong>{c.heading}</strong>
<small>{c.text}</small>
</span>
</label>
))}
</div>
{fm.capabilities_cta && (
<p class="cta-row">
<a class="button" href="#lead-form">{fm.capabilities_cta}</a>
</p>
)}
</section>
)
}
{fm.pricing_note && <section class="note"><p>{fm.pricing_note}</p></section>}
<slot />
{hasForm && <LeadForm type={pageId} locale={locale} strings={strings} site={site} />}
</main>
<footer>
<p>{strings.footer_tagline}</p>
<p>
<a href={`${localePrefix(locale)}/privacy/`}>{strings.nav_privacy}</a> ·
<a href={`${localePrefix(locale)}/cookies/`}>{strings.nav_cookies}</a> ·
<a href="/admin/">{strings.footer_edit_hint}</a>
</p>
<p>{strings.footer_hosting_note}</p>
</footer>
<script is:inline>
(() => {
// Checklist interactions feed self-hosted analytics: any element
// carrying data-umami-event reports on change, with its checked
// state. window.umami exists only for consented visitors — the
// analytics script is injected by the consent gate in <head>.
document.addEventListener("change", (event) => {
const el = event.target && event.target.closest ? event.target.closest("[data-umami-event]") : null;
if (!el) return;
try {
window.umami && window.umami.track(el.dataset.umamiEvent, { selected: !!el.checked });
} catch {}
});
})();
</script>
<div id="cookie-consent" role="region" aria-label={strings.cookie_notice}>
<p>{strings.cookie_notice}</p>
<button data-answer="yes">{strings.cookie_accept}</button>
<button data-answer="no">{strings.cookie_decline}</button>
</div>
</body>
</html>
<style is:global>
:root {
--ink: #16213a;
--muted: #5b6478;
--accent: #3a55d9;
--accent-soft: #eef1fd;
--line: #e3e7f2;
--bg: #fbfcfe;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
margin: 0;
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
color: var(--ink);
background: var(--bg);
line-height: 1.65;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1 { font-size: 2.3rem; line-height: 1.15; margin: 0 0 1rem; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; margin: 2.5rem 0 1rem; letter-spacing: -0.01em; }
h3 { font-size: 1.12rem; margin: 0 0 0.5rem; }
p { margin: 0 0 1rem; }
img { max-width: 100%; height: auto; border-radius: 0.5rem; }
.site-header nav {
display: flex;
gap: 1.25rem;
align-items: center;
flex-wrap: wrap;
padding: 0.9rem 2rem;
border-bottom: 1px solid var(--line);
background: #fff;
}
.site-header .brand {
font-weight: 700;
margin-inline-end: auto;
color: var(--ink);
text-decoration: none;
display: inline-flex;
gap: 0.5rem;
align-items: center;
}
.brand-mark {
width: 1.65rem;
height: 1.65rem;
flex: none;
}
.site-header nav a:not(.brand) {
color: var(--muted);
text-decoration: none;
font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--accent); }
.switcher { display: flex; gap: 0.45rem; align-items: center; font-size: 0.85rem; color: var(--muted); }
.switcher span { display: none; }
.switcher select {
font: inherit;
font-size: 0.85rem;
padding: 0.3rem 0.4rem;
border: 1px solid var(--line);
border-radius: 0.4rem;
background: #fff;
color: var(--ink);
}
main {
max-width: 46rem;
margin: 0 auto;
padding: 2.5rem 1.25rem 4rem;
}
.hero {
position: relative;
overflow: hidden;
margin-inline: -1.25rem;
margin-top: -2.5rem;
padding: 3.2rem 1.25rem 2.8rem;
background: linear-gradient(180deg, var(--accent-soft), var(--bg));
border-bottom: 1px solid var(--line);
}
.hero h1 { max-width: 30rem; }
.hero-sub { font-size: 1.15rem; color: var(--muted); max-width: 38rem; }
.cta-row { margin-top: 1.6rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.button {
display: inline-block;
background: var(--accent);
color: #fff !important;
border-radius: 0.5rem;
padding: 0.6rem 1.1rem;
text-decoration: none;
font-weight: 600;
font-size: 0.95rem;
border: 1px solid transparent;
}
.button:hover { filter: brightness(1.08); }
.button-secondary {
background: #fff;
color: var(--accent) !important;
border-color: var(--accent);
}
.cards { margin-top: 2rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.cards-section > h2 { margin-top: 2.5rem; }
.card {
background: #fff;
border: 1px solid var(--line);
border-radius: 0.7rem;
padding: 1.1rem 1.2rem;
margin: 0;
}
.card p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.card h2, .card h3 { margin: 0 0 0.5rem; }
.card-link {
display: inline-block;
margin-top: 0.7rem;
font-size: 0.92rem;
font-weight: 600;
text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.pilot-banner {
margin: 1.6rem 0 0;
padding: 0.9rem 1.2rem;
background: var(--accent);
color: #fff;
border-radius: 0.55rem;
}
.pilot-banner p { margin: 0.2rem 0 0; font-size: 0.95rem; }
.pilot-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; }
.pricing-note { margin: 0 0 1rem; color: var(--muted); font-size: 0.95rem; }
.cap-list, .price-list { grid-template-columns: 1fr; gap: 0.6rem; }
.card.cap {
display: flex;
gap: 0.8rem;
align-items: flex-start;
padding: 0.9rem 1.1rem;
cursor: pointer;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card.cap:hover { border-color: var(--accent); }
.card.cap:has(input:checked) {
border-color: var(--accent);
box-shadow: 0 0 0 1px var(--accent) inset;
background: var(--accent-soft);
}
.card.cap input {
width: 1.15rem;
height: 1.15rem;
margin-top: 0.2rem;
accent-color: var(--accent);
flex: none;
}
.cap-body { display: flex; flex-direction: column; gap: 0.2rem; }
.cap-body strong { color: var(--ink); }
.cap-body small { color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.capabilities .cta-row { margin-top: 1.2rem; }
.journey ol { padding: 0; margin: 0; list-style: none; counter-reset: none; display: grid; gap: 0.55rem; }
.journey li {
padding: 0.55rem 0.9rem;
background: #fff;
border: 1px solid var(--line);
border-inline-start: 3px solid var(--accent);
border-radius: 0.45rem;
color: var(--muted);
font-size: 0.97rem;
}
.journey li strong { color: var(--ink); margin-inline-end: 0.2rem; }
.note {
margin-top: 1.5rem;
padding: 0.9rem 1.2rem;
background: var(--accent-soft);
border-radius: 0.5rem;
}
.note p { margin: 0; }
form.lead {
margin-top: 2.5rem;
padding: 1.5rem 1.6rem;
background: #fff;
border: 1px solid var(--line);
border-radius: 0.8rem;
}
form.lead h2 { margin-top: 0; }
form.lead label { display: block; font-size: 0.9rem; margin-bottom: 1rem; }
form.lead input[type="text"], form.lead input[type="email"], form.lead select, form.lead textarea {
display: block;
width: 100%;
margin-top: 0.3rem;
font: inherit;
padding: 0.55rem 0.65rem;
border: 1px solid var(--line);
border-radius: 0.45rem;
color: var(--ink);
background: #fff;
}
form.lead textarea { min-height: 6rem; resize: vertical; }
form.lead label.consent { display: flex; gap: 0.5rem; align-items: start; }
form.lead .hp { position: absolute; inset-inline-start: -9999px; }
form.lead .cap-selection {
margin: 0 0 1rem;
padding: 0.45rem 0.7rem;
background: var(--accent-soft);
border-inline-start: 3px solid var(--accent);
border-radius: 0.4rem;
color: var(--ink);
font-size: 0.9rem;
}
footer {
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 0.85rem;
padding: 1.5rem 2rem 2rem;
text-align: center;
}
#cookie-consent {
position: fixed;
inset-inline: 0;
bottom: 0;
display: flex;
gap: 1rem;
align-items: center;
justify-content: center;
flex-wrap: wrap;
padding: 0.8rem 1.5rem;
background: var(--ink);
color: #fff;
font-size: 0.85rem;
}
#cookie-consent p { margin: 0; }
#cookie-consent button {
font: inherit;
font-size: 0.85rem;
border-radius: 0.4rem;
border: 1px solid rgba(255, 255, 255, 0.5);
background: transparent;
color: #fff;
padding: 0.35rem 0.8rem;
cursor: pointer;
}
#cookie-consent button[data-answer="yes"] { background: #fff; color: var(--ink); border-color: #fff; }
blockquote {
margin: 1.5rem 0;
padding: 0.5rem 1.25rem;
border-inline-start: 3px solid var(--accent);
color: var(--muted);
}
ul, ol { padding-inline-start: 1.5rem; }
@media (prefers-reduced-motion: no-preference) {
.hero { transition: none; }
}
</style>