U6: prerender statische tekst bij build, OG-afbeelding (simpele versie), opzet privacyverklaring

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 10:26:50 +01:00
co-authored by Claude Sonnet 5.5
parent 9516956d00
commit d38463465d
9 changed files with 182 additions and 4 deletions
+19
View File
@@ -0,0 +1,19 @@
import { renderToString } from 'react-dom/server';
import { describe, expect, it } from 'vitest';
import { StaticLanding } from './StaticLanding';
import { heroContent } from '../features/landing/data/content';
describe('StaticLanding (prerender)', () => {
const html = renderToString(<StaticLanding />);
it('contains the hero heading and the section headings', () => {
expect(html).toContain('<h1');
expect(html).toContain(heroContent.heading.replace('&', '&amp;'));
expect(html).toContain('Eén ontwikkelaar, korte lijnen');
expect(html).toContain('Van idee naar live in drie stappen');
});
it('does not render the dynamic contact panel', () => {
expect(html).not.toContain('data-testid="contact-panel"');
});
});
+39
View File
@@ -0,0 +1,39 @@
import { Hero } from '../features/landing/components/Hero';
import { AboutSection } from '../features/landing/components/AboutSection';
import { ProcessSection } from '../features/landing/components/ProcessSection';
import { ContactSection } from '../features/landing/components/ContactSection';
import { Footer } from '../components/layout/Footer';
/**
* Static, crawler-readable text of the landing page (NFR-9), rendered to HTML at build time by
* scripts/prerender.mjs and put inside #root of dist/index.html.
*
* Approach: NO hydration. main.tsx uses createRoot, which replaces this markup as soon as the
* app has loaded. That avoids hydration mismatches by construction (the real app reads
* localStorage/matchMedia while rendering; this tree must not). Only components without
* window/storage/query dependencies are used here. Dynamic parts (packages, banner, contact
* form) are NOT prerendered; the packages come from the CMS host markers in index.html.
*/
export function StaticLanding() {
return (
<>
<main id="main">
<Hero />
<AboutSection />
<section id="pakketten" aria-labelledby="pakketten-heading" className="bg-surface">
<div className="mx-auto max-w-[1280px] px-6 pb-24 pt-20 sm:px-8 md:pb-[136px] md:pt-32">
<h2
id="pakketten-heading"
className="max-w-[12ch] text-[clamp(40px,5.4vw,80px)] font-extrabold leading-[0.95] tracking-[-0.03em] [font-stretch:112%]"
>
Manieren om te starten.
</h2>
</div>
</section>
<ProcessSection />
<ContactSection panel={null} />
</main>
<Footer />
</>
);
}
+7
View File
@@ -0,0 +1,7 @@
import { renderToString } from 'react-dom/server';
import { StaticLanding } from './StaticLanding';
/** Entry of the build-time SSR bundle (see scripts/prerender.mjs). */
export function render(): string {
return renderToString(<StaticLanding />);
}