Moves the app to TanStack Start with prerendering
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>
This commit is contained in:
@@ -6,13 +6,12 @@ const SCRIPT_ELEMENT_ID = 'umami-analytics-script';
|
||||
// Bezoekersstatistieken zonder cookies (M6). Alleen op een bekende host, met
|
||||
// de website van die omgeving; data-domains telt nergens anders mee en
|
||||
// data-do-not-track respecteert de Do Not Track-instelling van de browser.
|
||||
export default function UmamiAnalytics({
|
||||
hostname = window.location.hostname,
|
||||
}: {
|
||||
hostname?: string;
|
||||
}) {
|
||||
export default function UmamiAnalytics({ hostname }: { hostname?: string }) {
|
||||
useEffect(() => {
|
||||
const monitoring = monitoringFor(hostname);
|
||||
// Read here, not as a default parameter: there is no window while
|
||||
// prerendering
|
||||
const host = hostname ?? window.location.hostname;
|
||||
const monitoring = monitoringFor(host);
|
||||
if (!monitoring || document.getElementById(SCRIPT_ELEMENT_ID)) return;
|
||||
|
||||
const script = document.createElement('script');
|
||||
@@ -20,7 +19,7 @@ export default function UmamiAnalytics({
|
||||
script.src = `${umamiOrigin}/script.js`;
|
||||
script.defer = true;
|
||||
script.dataset.websiteId = monitoring.umamiWebsiteId;
|
||||
script.dataset.domains = hostname;
|
||||
script.dataset.domains = host;
|
||||
script.dataset.doNotTrack = 'true';
|
||||
document.head.appendChild(script);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user