Skip to content

Commit 818399c

Browse files
committed
fix: next and prev post confusion
1 parent 867125a commit 818399c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pages/BlogPostPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ const BlogPostPage = () => {
291291
const currentPostIndex = post.seriesPosts ? post.seriesPosts.findIndex(
292292
(item) => item.slug === currentSlug,
293293
) : -1;
294-
const prevPost = currentPostIndex > 0 ? post.seriesPosts[currentPostIndex - 1] : null;
295-
const nextPost = post.seriesPosts && currentPostIndex < post.seriesPosts.length - 1
294+
const prevPost = post.seriesPosts && currentPostIndex < post.seriesPosts.length - 1
296295
? post.seriesPosts[currentPostIndex + 1]
297296
: null;
297+
const nextPost = currentPostIndex > 0 ? post.seriesPosts[currentPostIndex - 1] : null;
298298

299299
const backLink = post.attributes.series ? `/blog/series/${post.attributes.series.slug}` : '/blog';
300300
const backLinkText = post.attributes.series ? `Back to ${post.attributes.series.title}` : 'Back to Blog';

0 commit comments

Comments
 (0)