Every page is now built as HTML from sitePages.ts, with a catch-all route for 404.html. Hooks that read the browser during render are safe for prerendering. The script step that keeps the CSP intact follows, so this build still has inline scripts and is not deployable yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
886 B
TypeScript
24 lines
886 B
TypeScript
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.
|
|
// Start bouwt een client- en een serveromgeving; alleen de client komt in
|
|
// dist/client terecht, dus alleen daar wordt het bestand gemaakt.
|
|
export default function sitemapPlugin(): Plugin {
|
|
return {
|
|
name: 'slp-sitemap',
|
|
apply: 'build',
|
|
generateBundle() {
|
|
if (this.environment.name !== 'client') return;
|
|
this.emitFile({
|
|
type: 'asset',
|
|
fileName: 'sitemap.xml',
|
|
source: sitemapXml(pageList(sitePages), siteUrl),
|
|
});
|
|
},
|
|
};
|
|
}
|