export const dynamic = 'force-dynamic'; import { pb, type BlogPost } from "@/lib/pb"; import Link from "next/link"; import { notFound } from "next/navigation"; interface Props { params: { slug: string } } async function getPost(slug: string) { try { return await pb.collection("blog_posts").getFirstListItem(`slug="${slug}"`); } catch { return null; } } export default async function BlogPostPage({ params }: Props) { const post = await getPost(params.slug); if (!post) notFound(); const html = post.inhalt .replace(/^### (.+)$/gm,"

$1

").replace(/^## (.+)$/gm,"

$1

").replace(/^# (.+)$/gm,"

$1

") .replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1") .replace(/`(.+?)`/g,"$1").replace(/\[(.+?)\]\((.+?)\)/g,'$1') .replace(/\n\n/g,"

").replace(/^/,"

").replace(/$/,"

"); return (
← Blog

{post.titel}

{post.tags?.length > 0 &&
{post.tags.map(tag => {tag})}
}
); }