From 662a298b28cc33174926ac1870cd9b74fc056be6 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Sat, 25 Jan 2025 15:36:12 -0800 Subject: [PATCH] fix: Posts with empty series --- src/routes/post/[slug]/+page.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/post/[slug]/+page.ts b/src/routes/post/[slug]/+page.ts index a974f60..151f390 100644 --- a/src/routes/post/[slug]/+page.ts +++ b/src/routes/post/[slug]/+page.ts @@ -16,13 +16,13 @@ export const load: PageLoad = async ({ params }) => { prevTitle?: string, nextSlug?: 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 }); - let prevSlug = null; - let prevTitle = null; - let nextSlug = null; - let nextTitle = null; + let prevSlug = undefined; + let prevTitle = undefined; + let nextSlug = undefined; + let nextTitle = undefined; for (const p of postInSeries) { if (p.date > metadata.date) {