feat(podcast): add episode detail pages

This commit is contained in:
Oliver Davies 2023-11-07 22:06:27 +00:00
parent ad8a919554
commit 7356ae021d
5 changed files with 64 additions and 0 deletions

View file

@ -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(),
}),
});

View file

@ -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
---

View file

@ -3,5 +3,6 @@ date: 2023-11-07
topic: Drupal's Alternate Realities
guests:
- Panagiotis Moutsopoulos
links: []
draft: true
---

View file

@ -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;
---
<Layout title={`Episode ${id.match(/^[\d+]/)} - ${topic} with ${guests}`}>
<Markdown>
<Content />
{links && (
<div>
<h2>Links</h2>
<ul>
{links.map((link: {0: string, 1: string}) => (
<li>
<a href={link[1]}>{link[0]}</a>
</li>
))}
</ul>
</div>
)}
</Markdown>
</Layout>