feat(talks): make talk count dynamic

This commit is contained in:
Oliver Davies 2022-10-15 16:10:41 +01:00
parent d2244d084c
commit 9e2b8196bd

View file

@ -1,8 +1,15 @@
--- ---
import _ from 'lodash'
import PageLayout from '../../layouts/PageLayout.astro' import PageLayout from '../../layouts/PageLayout.astro'
const talks = await Astro.glob("../../talks/*.md") const talks = await Astro.glob("../../talks/*.md")
const talkCount = _(talks)
.map((talk) => talk.frontmatter.events)
.flatten()
.value()
.length
const sortedTalks = talks const sortedTalks = talks
.map(talk => { .map(talk => {
const parts = talk.file.replace('.md', '').split('/') const parts = talk.file.replace('.md', '').split('/')
@ -22,7 +29,7 @@ const sortedTalks = talks
--- ---
<PageLayout title="Talks and workshops"> <PageLayout title="Talks and workshops">
<p>Starting with my first talk in September 2012, I have given 85 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> <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>
<div> <div>
{sortedTalks.map((talk) => ( {sortedTalks.map((talk) => (