File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function getNextPost() {
1616 for (const post of posts ) {
1717 if (post .slug === slug ) {
1818 postIndex = posts .indexOf (post );
19- return posts [postIndex + 1 ];
19+ return posts [postIndex - 1 ];
2020 }
2121 }
2222}
@@ -26,7 +26,7 @@ function getPrevPost() {
2626 for (const post of posts ) {
2727 if (post .slug === slug ) {
2828 postIndex = posts .indexOf (post );
29- return posts [postIndex - 1 ];
29+ return posts [postIndex + 1 ];
3030 }
3131 }
3232}
Original file line number Diff line number Diff line change 22import { getActiveBlogPosts } from " src/util" ;
33import CaretIcon from " src/components/ui/CaretIcon.astro" ;
44
5- const posts = (await getActiveBlogPosts ()).slice (- 3 ). reverse ( );
5+ const posts = (await getActiveBlogPosts ()).slice (0 , 3 );
66---
77
88<section class =" bg-primary flex flex-col items-center px-4 py-10 text-white sm:px-6 lg:px-8" id =" blog" >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export async function getActiveBlogPosts(): Promise<BlogPost[]> {
1717export async function getAllBlogPosts ( ) : Promise < BlogPost [ ] > {
1818 const posts = ( await getCollection ( "blog" ) )
1919 . map ( ( post ) => parseBlogPost ( post ) )
20- . sort ( ( a , b ) => Temporal . ZonedDateTime . compare ( a . date , b . date ) ) ;
20+ . sort ( ( a , b ) => Temporal . ZonedDateTime . compare ( b . date , a . date ) ) ;
2121
2222 return posts ;
2323}
You can’t perform that action at this time.
0 commit comments