diff --git a/src/layouts/PostDetails.astro b/src/layouts/PostDetails.astro index a846060..ae7ae14 100644 --- a/src/layouts/PostDetails.astro +++ b/src/layouts/PostDetails.astro @@ -69,12 +69,13 @@ const layoutProps = { /* ========== Prev/Next Posts ========== */ -const allPosts = posts.map(({ data: { title }, id }) => ({ - slug: id, +const allPosts = posts.map(({ data: { title }, id, filePath }) => ({ + id, title, + filePath, })); -const currentPostIndex = allPosts.findIndex(a => a.slug === post.id); +const currentPostIndex = allPosts.findIndex(a => a.id === post.id); const prevPost = currentPostIndex !== 0 ? allPosts[currentPostIndex - 1] : null; const nextPost = @@ -125,7 +126,7 @@ const nextPost = { prevPost && ( @@ -139,7 +140,7 @@ const nextPost = { nextPost && (