File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,19 @@ import Hero from "../images/hero.jpg";
1515import LabCafe from " ../images/lab-cafe.jpg" ;
1616import LogoGMOMedia from " ../images/logo-gmo-media.png" ;
1717
18- const projects = (await getCollection (" projects" )).slice (0 , 6 );
19- const articles = (await getCollection (" articles" )).slice (0 , 6 );
18+ const projects = (await getCollection (" projects" ))
19+ .sort ((a , b ) => {
20+ const a_order = a .data .order ?? Number .POSITIVE_INFINITY,
21+ b_order = b .data .order ?? Number .POSITIVE_INFINITY;
22+ if (a_order !== b_order ) {
23+ return a_order - b_order ;
24+ }
25+ return b .data .date .getTime () - a .data .date .getTime ();
26+ })
27+ .slice (0 , 6 );
28+ const articles = (await getCollection (" articles" ))
29+ .sort ((a , b ) => b .data .date .getTime () - a .data .date .getTime ())
30+ .slice (0 , 6 );
2031---
2132
2233<GlobalLayout title ={ null } description ={ null } focus ={ Focus .none } >
You can’t perform that action at this time.
0 commit comments