import of old blog posts
Some checks failed
Build and Deploy Blog / build-and-deploy-local (push) Failing after 27s

This commit is contained in:
2026-03-31 13:45:11 +02:00
parent ca078295e2
commit 83bf4b4119
24 changed files with 453 additions and 4 deletions

View File

@@ -89,6 +89,16 @@ export function getAllPostIds() {
}
}
export function getAdjacentPosts(slug: string): { prev: PostMeta | null; next: PostMeta | null } {
const posts = getSortedPostsData(); // newest → oldest
const index = posts.findIndex((p) => p.id === slug);
if (index === -1) return { prev: null, next: null };
return {
prev: posts[index + 1] ?? null, // older
next: posts[index - 1] ?? null, // newer
};
}
export async function getPostData(id: string): Promise<PostData> {
const fullPath = path.join(postsDirectory, `${id}.mdx`);
if (!fs.existsSync(fullPath)) notFound();