--- import BaseLayout from '../../layouts/BaseLayout.astro'; import EpisodeCard from '../../components/episodes/EpisodeCard.astro'; import { getCollection, render } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; export async function getStaticPaths() { const episodes = await getCollection('episodes'); return episodes.map((episode) => ({ params: { slug: episode.id }, props: { episode }, })); } interface Props { episode: CollectionEntry<'episodes'>; } const { episode } = Astro.props; const { title, season, episode: episodeNum, pubDate, duration, audioUrl, tags, chapters, originalUrl } = episode.data; const { Content } = await render(episode); const formattedDate = new Date(pubDate).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', }); const seasonLabel = season === 0 ? 'Special' : `Season ${season}`; const episodeLabel = season === 0 ? 'Special' : `S${season} E${String(episodeNum).padStart(2, '0')}`; const allEpisodes = await getCollection('episodes'); const relatedEpisodes = allEpisodes .filter((ep) => ep.data.season === season && ep.id !== episode.id) .sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime()) .slice(0, 4); ---
{episodeLabel}

{title}

{duration}
{chapters && chapters.length > 0 && (

Chapters

    {chapters.map((chapter) => (
  1. {chapter.time} {chapter.title}
  2. ))}
)}

Show Notes

{tags.length > 0 && (

Tags

{tags.map((tag: string) => ( {tag} ))}
)}

Listen On

{relatedEpisodes.length > 0 && ( )}