fix: Posts with empty series
This commit is contained in:
parent
e7984f9c33
commit
662a298b28
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue