feat(podcast): add drafts for the initial episodes
This commit is contained in:
parent
8bc240aa6a
commit
23d9e92a5d
|
@ -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,
|
||||
|
|
9
src/content/podcast-episode/1-retrofit.md
Normal file
9
src/content/podcast-episode/1-retrofit.md
Normal file
|
@ -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.
|
7
src/content/podcast-episode/2-alternate-realities.md
Normal file
7
src/content/podcast-episode/2-alternate-realities.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
date: 2023-11-07
|
||||
topic: Drupal's Alternate Realities
|
||||
guests:
|
||||
- Panagiotis Moutsopoulos
|
||||
draft: true
|
||||
---
|
40
src/pages/podcast.astro
Normal file
40
src/pages/podcast.astro
Normal file
|
@ -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();
|
||||
---
|
||||
|
||||
<PageLayout title="The Beyond Blocks podcast">
|
||||
{filteredEpisodes.isEmpty() ? (
|
||||
<p>Coming soon...</p>
|
||||
) : (
|
||||
<>
|
||||
<h2>Episodes</h2>
|
||||
|
||||
{sortedEpisodes.map((episode: Episode) => (
|
||||
<article>
|
||||
<h3>Episode {episode.id.match(/^[\d+]/)} - {`${episode.data.topic} with ${episode.data.guests}`}</h3>
|
||||
|
||||
<time datetime={format(episode.data.date, 'Y-MM-dd')}>
|
||||
{format(episode.data.date, 'PPP')}
|
||||
</time>
|
||||
|
||||
<Markdown set:html={sanitizeHtml(parser.render(episode.body))} />
|
||||
</article>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</PageLayout>
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
layout: ~/layouts/PageLayout.astro
|
||||
title: The Beyond Blocks podcast
|
||||
---
|
||||
|
||||
Coming soon...
|
12
src/types.ts
Normal file
12
src/types.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
type Episode = {
|
||||
body: string;
|
||||
data: {
|
||||
date: Date;
|
||||
draft?: boolean;
|
||||
guests: Array<string>;
|
||||
topic: string;
|
||||
};
|
||||
id: string;
|
||||
}
|
||||
|
||||
export type { Episode }
|
Loading…
Reference in a new issue