Files
windwiderstand.de/src/pages/[slug].astro
T
2026-02-13 15:58:36 +01:00

47 lines
1.2 KiB
Plaintext

---
import Layout from '../layouts/Layout.astro';
import { getPageSlugs, getPageBySlug } from '../lib/cms';
export const prerender = true;
export async function getStaticPaths() {
try {
const slugs = await getPageSlugs();
return slugs.map((slug) => ({ params: { slug } }));
} catch (e) {
console.error('getStaticPaths (pages):', e);
return [];
}
}
const { slug } = Astro.params as { slug: string };
const page = await getPageBySlug(slug);
if (!page) {
return Astro.redirect('/404');
}
---
<Layout
title={page.seoTitle ?? page.headline ?? page.linkName ?? slug}
description={page.seoDescription ?? page.subheadline}
>
<main class="mx-auto max-w-3xl px-4 py-12">
<article>
<header class="mb-8">
<h1 class="text-3xl font-bold tracking-tight text-zinc-900">
{page.headline ?? page.linkName ?? page._slug}
</h1>
{page.subheadline && (
<p class="mt-2 text-lg text-zinc-600">
{page.subheadline}
</p>
)}
</header>
<div class="prose prose-zinc max-w-none">
<!-- Weitere Felder (z.B. row1Content, topFullwidthBanner) können hier gerendert werden -->
</div>
</article>
</main>
</Layout>