feat(admin): add demo mode toggle in admin dashboard and rewrite 404 page for missing routes
Some checks failed
Production Build & Deploy / build-and-deploy (push) Has been cancelled

This commit is contained in:
Daniel S
2026-08-09 22:43:36 +02:00
parent 5e9b69c319
commit baa639a9b2
3 changed files with 21 additions and 3 deletions

View File

@@ -71,11 +71,13 @@ let page = pages.find((p: any) => {
return p.slug === currentSlug || p.slug === `/${currentSlug}`;
});
// 5. Zero-Crash Fallback Guard: Wenn Seite fehlt oder unveröffentlicht ist
if (!page || (page.is_published === false && import.meta.env.PROD)) {
return Astro.redirect('/404');
// 5. Zero-Crash Fallback Guard: Wenn Seite nicht existiert oder nicht veröffentlicht ist -> 404 Status
if (!page || (page.is_published === false && !isDraft)) {
Astro.response.status = 404;
return Astro.rewrite('/404');
}
// 6. Dynamic Component Registry Mapping
const ComponentRegistry: Record<string, any> = {
hero: HeroSection,