Completes the front-end shell with footer, status pages and SEO

Adds the footer, back-to-top button, skip link, placeholder routes,
404 and error pages inside the shell, plus per-page SEO from a single
page registry (canonical URLs, Open Graph image, JSON-LD, generated
sitemap.xml and robots.txt).

Theme tokens and recipes replace repeated styling, the hero loads only
the active and neighbouring slides, and the e-mail address is joined
in the browser to keep it out of the HTML and bundle.

Adds Vitest with property-based (fast-check) and axe tests, ESLint,
security headers for dev and preview, Lighthouse CI and a `pnpm check`
script that runs all quality gates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-18 17:05:02 +02:00
co-authored by Claude Opus 5.5
parent b5b7f3b3db
commit 4d6408b607
99 changed files with 7883 additions and 414 deletions
+35
View File
@@ -0,0 +1,35 @@
import { describe, expect, it } from 'vitest';
import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
const directive = (csp: string, name: string) =>
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
describe('securityHeaders', () => {
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
const csp = contentSecurityPolicy('production');
expect(csp).not.toContain('unsafe-eval');
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
expect(csp).not.toContain('ws:');
expect(directive(csp, 'frame-ancestors')).toBe(
"frame-ancestors 'none'",
);
});
it('dev-CSP voegt alleen toe wat Vite nodig heeft', () => {
const csp = contentSecurityPolicy('development');
expect(directive(csp, 'script-src')).toBe(
"script-src 'self' 'unsafe-inline'",
);
expect(directive(csp, 'connect-src')).toBe("connect-src 'self' ws:");
expect(csp).not.toContain('unsafe-eval');
});
it('zet alle verplichte headers', () => {
expect(securityHeaders('production')).toMatchObject({
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
'X-Content-Type-Options': 'nosniff',
'X-Frame-Options': 'DENY',
'Referrer-Policy': 'strict-origin-when-cross-origin',
});
});
});
+49
View File
@@ -0,0 +1,49 @@
// HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is
// ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02).
type Mode = 'production' | 'development';
// Chakra/Emotion zetten tijdens runtime <style>-tags in de pagina, daarom
// staat style-src 'unsafe-inline' toe. Scripts komen alleen van de eigen site.
const productionCsp: Record<string, string[]> = {
'default-src': ["'self'"],
'script-src': ["'self'"],
'style-src': ["'self'", "'unsafe-inline'"],
'img-src': ["'self'", 'data:'],
'font-src': ["'self'"],
'connect-src': ["'self'"],
'object-src': ["'none'"],
'base-uri': ["'self'"],
'form-action': ["'self'"],
'frame-ancestors': ["'none'"],
};
// Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor
// React Refresh en een websocket voor hot reload.
const developmentExtras: Record<string, string[]> = {
'script-src': ["'unsafe-inline'"],
'connect-src': ['ws:'],
};
export function contentSecurityPolicy(mode: Mode): string {
return Object.entries(productionCsp)
.map(([directive, sources]) => {
const extra =
mode === 'development'
? (developmentExtras[directive] ?? [])
: [];
return [directive, ...sources, ...extra].join(' ');
})
.join('; ');
}
export function securityHeaders(mode: Mode): Record<string, string> {
return {
'Content-Security-Policy': contentSecurityPolicy(mode),
// Browsers negeren HSTS over http://localhost; telt pas op de echte host
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
'X-Content-Type-Options': 'nosniff',
'X-Frame-Options': 'DENY',
'Referrer-Policy': 'strict-origin-when-cross-origin',
};
}
+20
View File
@@ -0,0 +1,20 @@
import type { Plugin } from 'vite';
import { siteUrl } from '../src/seo.ts';
import sitePages, { pageList } from '../src/sitePages.ts';
import { sitemapXml } from '../src/sitemap.ts';
// Maakt bij elke build dist/sitemap.xml uit het pagina-register. Route-heads
// lezen hetzelfde register, dus sitemap en noindex lopen nooit uit elkaar.
export default function sitemapPlugin(): Plugin {
return {
name: 'slp-sitemap',
apply: 'build',
generateBundle() {
this.emitFile({
type: 'asset',
fileName: 'sitemap.xml',
source: sitemapXml(pageList(sitePages), siteUrl),
});
},
};
}
+20
View File
@@ -0,0 +1,20 @@
import type { TestProject } from 'vitest/node';
// Kiest één seed voor alle property-tests van een run en logt die altijd,
// ook als alles slaagt (PBT-08). Opnieuw afspelen: FC_SEED=<seed> pnpm test
export default function setup(project: TestProject) {
const env = (
globalThis as { process?: { env: Record<string, string | undefined> } }
).process?.env;
const seed = Number(env?.FC_SEED ?? Math.floor(Math.random() * 2 ** 31));
console.log(
`\nfast-check seed: ${seed} (opnieuw: FC_SEED=${seed} pnpm test)\n`,
);
project.provide('fcSeed', seed);
}
declare module 'vitest' {
export interface ProvidedContext {
fcSeed: number;
}
}