From 7356ae021d5ae82d509190cd0d4bc84061ae93de Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Tue, 7 Nov 2023 22:06:27 +0000 Subject: [PATCH] feat(podcast): add episode detail pages --- src/content/config.ts | 1 + src/content/podcast-episode/1-retrofit.md | 21 ++++++++++ .../podcast-episode/2-alternate-realities.md | 1 + src/pages/podcast/[slug].astro | 41 +++++++++++++++++++ .../{podcast.astro => podcast/index.astro} | 0 5 files changed, 64 insertions(+) create mode 100644 src/pages/podcast/[slug].astro rename src/pages/{podcast.astro => podcast/index.astro} (100%) diff --git a/src/content/config.ts b/src/content/config.ts index 2f527084..51bd51af 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -25,6 +25,7 @@ const podcastEpisodeCollection = defineCollection({ date: z.date(), draft: z.boolean().optional(), guests: z.array(z.string()), + links: z.array(z.array(z.string())), topic: z.string(), }), }); diff --git a/src/content/podcast-episode/1-retrofit.md b/src/content/podcast-episode/1-retrofit.md index 6fca12b3..44003465 100644 --- a/src/content/podcast-episode/1-retrofit.md +++ b/src/content/podcast-episode/1-retrofit.md @@ -3,6 +3,27 @@ date: 2023-11-06 topic: Retrofit guests: - Matt Glaman +links: + - - Retrofit + - https://retrofit-drupal.com + + - - Retrofit on GitHub + - https://github.com/retrofit-drupal/retrofit + + - - "Blog post: Running legacy Drupal 7 code on your Drupal 10 site" + - https://mglaman.dev/blog/retrofit-running-legacy-drupal-7-code-your-drupal-10-site + + - - Matt on GitHub + - https://github.com/mglaman + + - - Matt on Drupal.org + - https://www.drupal.org/u/mglaman + + - - Matt on YouTube + - https://www.youtube.com/@nmdmatt + + - - Matt on Twitch + - https://www.twitch.tv/mglaman draft: true --- diff --git a/src/content/podcast-episode/2-alternate-realities.md b/src/content/podcast-episode/2-alternate-realities.md index 880cdb23..e7db6d34 100644 --- a/src/content/podcast-episode/2-alternate-realities.md +++ b/src/content/podcast-episode/2-alternate-realities.md @@ -3,5 +3,6 @@ date: 2023-11-07 topic: Drupal's Alternate Realities guests: - Panagiotis Moutsopoulos +links: [] draft: true --- diff --git a/src/pages/podcast/[slug].astro b/src/pages/podcast/[slug].astro new file mode 100644 index 00000000..544c4681 --- /dev/null +++ b/src/pages/podcast/[slug].astro @@ -0,0 +1,41 @@ +--- +import Layout from "~/layouts/Layout.astro"; +import Markdown from "~/components/Markdown.astro"; +import { getCollection } from "astro:content"; + +export async function getStaticPaths() { + const episodes = await getCollection("podcast-episode"); + const publishedEpisodes = episodes.filter((episode) => !episode.data.draft); + + return publishedEpisodes.map((episode) => { + return { + params: { slug: episode.slug }, + props: { episode }, + }; + }); +} + +const { Content } = await Astro.props.episode.render(); +const { id } = Astro.props.episode; +const { guests, links, title, topic } = Astro.props.episode.data; +--- + + + + + + + {links && ( +
+

Links

+
    + {links.map((link: {0: string, 1: string}) => ( +
  • + {link[0]} +
  • + ))} +
+
+ )} +
+
diff --git a/src/pages/podcast.astro b/src/pages/podcast/index.astro similarity index 100% rename from src/pages/podcast.astro rename to src/pages/podcast/index.astro