Personal Site
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Sort posts

+8 -2
+8 -2
src/components/home/Blog.astro
··· 5 5 import Hr from "/assets/hr.png"; 6 6 import Box4x3Mask from "/assets/box-4x3-mask.png"; 7 7 8 - const posts = await getCollection("blog"); 8 + const posts = await getCollection("blog").then((x) => 9 + x.sort( 10 + (a, b) => 11 + // cast needed as you can subtract Date but ts doesnt like it 12 + (b.data.pub as unknown as number) - (a.data.pub as unknown as number), 13 + ), 14 + ); 9 15 10 16 interface Props { 11 17 heading?: string; 12 18 } 13 19 14 - const HeadingLevel = Astro.props.heading ?? "h2" 20 + const HeadingLevel = Astro.props.heading ?? "h2"; 15 21 --- 16 22 17 23 <section