From 2f61b4a453cc8d97fe2dce9f62a3f93375c69bed Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Mon, 11 Nov 2024 10:23:38 -0500 Subject: [PATCH] switch next and previous links to match chronological post order --- src/routes/[slug]/+page.server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/[slug]/+page.server.js b/src/routes/[slug]/+page.server.js index 90ef6cb..d9c9bc0 100644 --- a/src/routes/[slug]/+page.server.js +++ b/src/routes/[slug]/+page.server.js @@ -4,7 +4,7 @@ import { postData } from '../_posts/all.js'; export function load({ params }) { const i = postData.findIndex(p => p.slug === params.slug); return { - prev: i > 0 ? postData[i - 1].slug : null, - next: i < postData.length - 1 ? postData[i + 1].slug : null, + prev: i < postData.length - 1 ? postData[i + 1].slug : null, + next: i > 0 ? postData[i - 1].slug : null, }; -} \ No newline at end of file +}