From b07ee5cdcc9b6d6a864f441b291410eb745f0fba Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Thu, 12 Jun 2025 22:51:02 +0700 Subject: [PATCH] fix: replace broken prev/next links with correct paths (#533) Nested blog post URLs in the prev/next links were not updated properly, which resulted in 404 error pages. This commit updates the outdated URLs to the correct paths. --- src/layouts/PostDetails.astro | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 && (