diff --git a/src/content/config.ts b/src/content/config.ts index 2c3ec1d1..2f527084 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -20,6 +20,15 @@ const dailyEmailCollection = defineCollection({ }), }); +const podcastEpisodeCollection = defineCollection({ + schema: z.object({ + date: z.date(), + draft: z.boolean().optional(), + guests: z.array(z.string()), + topic: z.string(), + }), +}); + const talkCollection = defineCollection({ schema: z.object({ description: z.string(), @@ -65,6 +74,7 @@ const testimonialCollection = defineCollection({ export const collections = { "daily-email": dailyEmailCollection, + "podcast-episode": podcastEpisodeCollection, blog: blogCollection, talk: talkCollection, testimonial: testimonialCollection, diff --git a/src/content/podcast-episode/1-retrofit.md b/src/content/podcast-episode/1-retrofit.md new file mode 100644 index 00000000..6fca12b3 --- /dev/null +++ b/src/content/podcast-episode/1-retrofit.md @@ -0,0 +1,9 @@ +--- +date: 2023-11-06 +topic: Retrofit +guests: + - Matt Glaman +draft: true +--- + +In this episode, Oliver is joined by Matt Glaman to discuss Retrofit. A tool that makes it easier to upgrade Drupal websites by allowing legacy Drupal code to run on any version of Drupal. diff --git a/src/content/podcast-episode/2-alternate-realities.md b/src/content/podcast-episode/2-alternate-realities.md new file mode 100644 index 00000000..880cdb23 --- /dev/null +++ b/src/content/podcast-episode/2-alternate-realities.md @@ -0,0 +1,7 @@ +--- +date: 2023-11-07 +topic: Drupal's Alternate Realities +guests: + - Panagiotis Moutsopoulos +draft: true +--- diff --git a/src/pages/podcast.astro b/src/pages/podcast.astro new file mode 100644 index 00000000..6ff19cc0 --- /dev/null +++ b/src/pages/podcast.astro @@ -0,0 +1,40 @@ +--- +import _ from "lodash"; +import Markdown from "~/components/Markdown.astro"; +import MarkdownIt from "markdown-it"; +import PageLayout from "~/layouts/PageLayout.astro"; +import sanitizeHtml from "sanitize-html"; +import type { Episode } from "~/types"; +import { format } from "date-fns"; +import { getCollection } from "astro:content"; + +let episodes: Episode[]; +episodes = await getCollection("podcast-episode"); + +const filteredEpisodes = _(episodes).filter(episode => !episode.data.draft ?? false); +const sortedEpisodes = _(filteredEpisodes).reverse(); + +const parser = new MarkdownIt(); +--- + + + {filteredEpisodes.isEmpty() ? ( +

Coming soon...

+ ) : ( + <> +

Episodes

+ + {sortedEpisodes.map((episode: Episode) => ( +
+

Episode {episode.id.match(/^[\d+]/)} - {`${episode.data.topic} with ${episode.data.guests}`}

+ + + + +
+ ))} + + )} +
diff --git a/src/pages/podcast.mdx b/src/pages/podcast.mdx deleted file mode 100644 index 0e27a756..00000000 --- a/src/pages/podcast.mdx +++ /dev/null @@ -1,6 +0,0 @@ ---- -layout: ~/layouts/PageLayout.astro -title: The Beyond Blocks podcast ---- - -Coming soon... diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 00000000..dc62e906 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,12 @@ +type Episode = { + body: string; + data: { + date: Date; + draft?: boolean; + guests: Array; + topic: string; + }; + id: string; +} + +export type { Episode }