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:
@@ -0,0 +1,33 @@
|
||||
import { canonicalUrl } from './seo.ts';
|
||||
import type { SitePage } from './sitePages.ts';
|
||||
|
||||
const escapeXml = (value: string) =>
|
||||
value
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
|
||||
// sitemap.xml met alleen de geïndexeerde pagina's, elke URL één keer.
|
||||
// Geen lastmod: Google negeert onbetrouwbare datums (BR-SEO-06).
|
||||
export function sitemapXml(
|
||||
pages: readonly Pick<SitePage, 'path' | 'indexed'>[],
|
||||
base: string,
|
||||
): string {
|
||||
const urls = new Set(
|
||||
pages
|
||||
.filter((page) => page.indexed)
|
||||
.map((page) => canonicalUrl(page.path, base)),
|
||||
);
|
||||
const entries = [...urls]
|
||||
.map((url) => ` <url><loc>${escapeXml(url)}</loc></url>`)
|
||||
.join('\n');
|
||||
|
||||
return (
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n' +
|
||||
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n' +
|
||||
(entries ? `${entries}\n` : '') +
|
||||
'</urlset>\n'
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user