@@ -6,7 +6,7 @@ import ProgressiveImage from '../components/ProgressiveImage.astro';
66const photos = await getCollection (' posts' , ({ data }) => ! data .draft && data .type === ' photography' );
77const sorted = photos .sort ((a , b ) => new Date (b .data .date ).getTime () - new Date (a .data .date ).getTime ());
88const selected = sorted .slice (0 , 6 );
9- const archive = sorted .slice (0 );
9+ const archive = sorted .slice (selected . length );
1010const filters = [
1111 { label: ' All' , value: ' all' },
1212 { label: ' Cafe' , value: ' cafe' },
@@ -17,6 +17,7 @@ const filters = [
1717 { label: ' Film' , value: ' film' },
1818] as const ;
1919const years = [... new Set (sorted .map ((photo ) => photo .data .date .getFullYear ()))].sort ((a , b ) => b - a );
20+ const archiveStartYear = archive [0 ]?.data .date .getFullYear () ?? years [0 ];
2021
2122function firstImage(photo : typeof sorted [number ]) {
2223 return photo .data .gallery ?.[0 ];
@@ -130,7 +131,7 @@ function filterGroups(photo: typeof sorted[number]) {
130131 <div class =" photo-section__head" >
131132 <div >
132133 <p class =" eyebrow" >Archive</p >
133- <h2 id =" archive-title" >Archive · { years [ 0 ] } </h2 >
134+ <h2 id =" archive-title" >Archive · { archiveStartYear } </h2 >
134135 </div >
135136 </div >
136137
0 commit comments