the validationlab.eu marketing site: 3 audience pages (en) + legal skeletons, i18n scaffold (25 locales, subdirectory scheme), structured frontmatter blocks, Zoho Flow lead forms with capability tagging + honeypot, sitemap/hreflang/JSON-LD/robots, cookie-gated analytics plumbing
This commit is contained in:
1 parent
95af7107d0
commit
477bf5114f
1076 files changed
+227743
-110
No files matched your search
+433
-67
@@ -1,83 +1,449 @@
|
||||
---
|
||||
const pageFiles = import.meta.glob("../pages/**/*.md", { eager: true });
|
||||
const pages = Object.entries(pageFiles)
|
||||
.map(([file, mod]) => {
|
||||
const slug = file.replace("../pages", "").replace(/\.md$/, "");
|
||||
return {
|
||||
href: slug === "/index" ? "/" : slug,
|
||||
label: mod.frontmatter?.title ?? slug,
|
||||
};
|
||||
// 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.
|
||||
const alternates = Object.keys(pageModules)
|
||||
.map((file) => {
|
||||
const m = file.match(/\.\.\/pages\/(?:([^/]+)\/)?([^/]+)\.md$/);
|
||||
if (!m) return null;
|
||||
const [, code, name] = m;
|
||||
const id = name === "index" ? "" : name;
|
||||
return { code: code ?? DEFAULT_LOCALE, id };
|
||||
})
|
||||
.sort((a, b) => a.href.localeCompare(b.href));
|
||||
// Markdown pages hand their frontmatter to the layout as `frontmatter`.
|
||||
const { title } = Astro.props.frontmatter ?? Astro.props;
|
||||
.filter((v) => v && v.id === pageId && (localeByCode(v.code) || v.code === DEFAULT_LOCALE));
|
||||
|
||||
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 = ["", "for-founders", "for-innovation-hubs", "privacy", "cookies"];
|
||||
const navEntries = alternates
|
||||
.filter((a) => order.includes(a.id))
|
||||
.map((a) => ({
|
||||
id: a.id,
|
||||
href: `${localePrefix(locale)}${a.id === "" ? "/" : `/${a.id}/`}`,
|
||||
label:
|
||||
a.id === "" ? strings.nav_home
|
||||
: 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 jsonLd =
|
||||
pageId === ""
|
||||
? {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Organization",
|
||||
name: site.brand,
|
||||
url: baseUrl,
|
||||
description,
|
||||
}
|
||||
: {
|
||||
"@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,
|
||||
};
|
||||
|
||||
const hasForm = pageId === "for-founders" || pageId === "for-innovation-hubs";
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang={locale} dir={dir}>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{title}</title>
|
||||
<style is:global>
|
||||
:root {
|
||||
--ink: #1f2937;
|
||||
--muted: #6b7280;
|
||||
--accent: #4f46e5;
|
||||
--line: #e5e7eb;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||
color: var(--ink);
|
||||
line-height: 1.65;
|
||||
}
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 1.25rem;
|
||||
align-items: center;
|
||||
padding: 0.9rem 2rem;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
nav .brand { font-weight: 700; margin-right: auto; }
|
||||
nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
|
||||
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }
|
||||
main { max-width: 44rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
|
||||
main :is(h1, h2, h3) { line-height: 1.25; }
|
||||
main h1 { font-size: 2.1rem; margin: 0 0 1.25rem; }
|
||||
main h2 { font-size: 1.45rem; margin-top: 2.25rem; }
|
||||
main img { max-width: 100%; height: auto; border-radius: 0.5rem; }
|
||||
main blockquote {
|
||||
margin: 1.5rem 0;
|
||||
padding: 0.5rem 1.25rem;
|
||||
border-left: 3px solid var(--accent);
|
||||
color: var(--muted);
|
||||
}
|
||||
main ul, main ol { padding-inline-start: 1.5rem; }
|
||||
footer {
|
||||
border-top: 1px solid var(--line);
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
padding: 1.25rem 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<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.
|
||||
const banner = document.getElementById("cookie-consent");
|
||||
if (!banner) return;
|
||||
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 {}
|
||||
banner.remove();
|
||||
if (allow) injectStats();
|
||||
};
|
||||
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();
|
||||
}
|
||||
})();`}
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<span class="brand">{title}</span>
|
||||
{pages.map((p) => (
|
||||
<a href={p.href} aria-current={Astro.url.pathname === p.href ? "page" : undefined}>
|
||||
{p.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
<header class="site-header">
|
||||
<nav>
|
||||
<a class="brand" href={`${localePrefix(locale)}/`}>{site.brand}</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>
|
||||
)
|
||||
}
|
||||
|
||||
{
|
||||
Array.isArray(fm.value_props) && fm.value_props.length > 0 && (
|
||||
<section class="cards" aria-label={fm.value_props_title}>
|
||||
{fm.value_props.map((v) => (
|
||||
<article class="card">
|
||||
<h2>{v.heading}</h2>
|
||||
<p>{v.text}</p>
|
||||
</article>
|
||||
))}
|
||||
</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">
|
||||
{fm.capabilities.map((c) => (
|
||||
<article class="card">
|
||||
<h3>{c.heading}</h3>
|
||||
<p>{c.text}</p>
|
||||
<a
|
||||
class="button button-secondary"
|
||||
data-umami-event={`capability-${c.key}`}
|
||||
data-cap={c.key}
|
||||
href={`${localePrefix(locale)}/for-innovation-hubs/#lead-form`}
|
||||
>{c.cta}</a>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</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>
|
||||
This page is editable in the browser at
|
||||
<a href="/admin/">/admin/</a> — no git knowledge required.
|
||||
<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>
|
||||
|
||||
<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;
|
||||
}
|
||||
.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 {
|
||||
margin-inline: -1.25rem;
|
||||
margin-top: -2.5rem;
|
||||
padding: 3.2rem 1.25rem 2.6rem;
|
||||
background: linear-gradient(180deg, var(--accent-soft), var(--bg));
|
||||
}
|
||||
.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)); }
|
||||
.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; }
|
||||
|
||||
.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; }
|
||||
|
||||
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>
|
||||
Reference in new issue
Block a user