From 9e2b8196bd605c480912d27f2369e913fe603945 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.uk> Date: Sat, 15 Oct 2022 16:10:41 +0100 Subject: [PATCH] feat(talks): make talk count dynamic --- website/src/pages/talks/index.astro | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/src/pages/talks/index.astro b/website/src/pages/talks/index.astro index 719c7b25c..1305bb301 100644 --- a/website/src/pages/talks/index.astro +++ b/website/src/pages/talks/index.astro @@ -1,8 +1,15 @@ --- +import _ from 'lodash' import PageLayout from '../../layouts/PageLayout.astro' const talks = await Astro.glob("../../talks/*.md") +const talkCount = _(talks) + .map((talk) => talk.frontmatter.events) + .flatten() + .value() + .length + const sortedTalks = talks .map(talk => { const parts = talk.file.replace('.md', '').split('/') @@ -22,7 +29,7 @@ const sortedTalks = talks --- <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> {sortedTalks.map((talk) => (