oliverdavies.uk/src/pages/talks/index.astro

47 lines
1.2 KiB
Text
Raw Normal View History

2022-10-07 09:14:10 +01:00
---
import ListingPage from "~/components/ListingPage.astro";
import _ from "lodash";
import { getCollection } from "astro:content";
import Markdown from "~/components/Markdown.astro";
2022-10-07 09:14:10 +01:00
const talks = await getCollection("talk");
2022-10-07 09:14:10 +01:00
2022-10-15 16:10:41 +01:00
const talkCount = _(talks)
.flatMap((talk) => talk.data.events)
2023-01-08 19:25:23 +00:00
.size();
2022-10-15 16:10:41 +01:00
2022-10-07 09:14:10 +01:00
const sortedTalks = talks
2023-01-08 19:25:23 +00:00
.map((talk) => {
const slug = `/talks/${talk.slug}`;
2022-10-07 09:14:10 +01:00
return { slug, item: talk };
2022-10-07 09:14:10 +01:00
})
.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],
2023-01-08 19:25:23 +00:00
];
2022-10-07 09:14:10 +01:00
const dates = [
new Date(events[0].date).valueOf(),
new Date(events[1].date).valueOf(),
];
if (dates[0] >= today) {
return 1;
}
return dates[0] - dates[1];
2023-01-08 19:25:23 +00:00
});
2022-10-07 09:14:10 +01:00
---
<ListingPage items={sortedTalks} title="Talks and workshops">
2023-07-13 14:52:51 +01:00
<Markdown slot="intro">
<p>
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>
</Markdown>
</ListingPage>