Erste brauchbare Version

This commit is contained in:
timg
2026-08-31 19:55:41 +02:00
parent 080c4d0f39
commit 892a4d4747
35 changed files with 7103 additions and 219 deletions
+15
View File
@@ -0,0 +1,15 @@
import Link from 'next/link';
export default function Page() {
return (
<div className="min-h-screen flex flex-col justify-center items-center">
<p>Post nicht gefunden</p>
<Link
className="border border-1 border-primary"
href="/"
>
Zurück
</Link>
</div>
);
}
+48
View File
@@ -0,0 +1,48 @@
import { notFound } from 'next/navigation';
import Link from 'next/link';
import { getPreview } from '@/lib/preview';
import config from '@payload-config';
import { getPayload } from 'payload';
import { RichText } from '@payloadcms/richtext-lexical/react';
type Props = Readonly<{
params: Promise<{
slug: string;
}>;
}>;
export default async function Page({ params }: Props) {
const { isPreview, where } = await getPreview();
const { slug } = await params;
const payload = await getPayload({ config });
const result = await payload.find({
collection: 'posts',
where: {
...where,
slug: {
equals: slug
}
},
draft: isPreview,
limit: 1
});
const post = result.docs[0];
if (!post)
return notFound();
return (
<div className="m-4">
<Link
className="border border-1 border-primary"
href="/"
>
Zurück
</Link>
<h1 className="font-bold">{post.title}</h1>
<RichText data={post.content} />
</div>
);
}