fix: Posts with empty series

This commit is contained in:
Leni Aniva 2025-01-25 15:36:12 -08:00
parent e7984f9c33
commit 662a298b28
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 5 additions and 5 deletions

View File

@ -16,13 +16,13 @@ export const load: PageLoad = async ({ params }) => {
prevTitle?: string, prevTitle?: string,
nextSlug?: string, nextSlug?: string,
nextTitle?: string, nextTitle?: string,
}[] = await Promise.all(post.metadata.series.map(async (series: string) => { }[] = await Promise.all((metadata.series || []).map(async (series: string) => {
const postInSeries: Post[] = await getPosts({ series }); const postInSeries: Post[] = await getPosts({ series });
let prevSlug = null; let prevSlug = undefined;
let prevTitle = null; let prevTitle = undefined;
let nextSlug = null; let nextSlug = undefined;
let nextTitle = null; let nextTitle = undefined;
for (const p of postInSeries) { for (const p of postInSeries) {
if (p.date > metadata.date) { if (p.date > metadata.date) {