--- import ListingPage from "~/components/ListingPage.astro"; import _ from "lodash"; import { getCollection } from 'astro:content'; const talks = await getCollection('talk'); const talkCount = _(talks) .flatMap((talk) => talk.data.events) .size(); const sortedTalks = talks .map((talk) => { const slug = `/talks/${talk.slug}` return { slug, item: talk }; }) .sort((b, a) => { const events = [ a.item.data.events[a.item.data.events.length - 1], b.item.data.events[b.item.data.events.length - 1], ]; return ( new Date(events[0].date).valueOf() - new Date(events[1].date).valueOf() ); }); --- <ListingPage items={sortedTalks} title="Talks and workshops"> <p slot="intro"> Starting with my first talk in September 2012, I have given {talkCount} presentations and workshops at various conferences and meetups, in-person and remotely, on topics including PHP, Drupal, automated testing, Git, CSS, and systems administration. </p> </ListingPage>