diff --git a/src/content/config.ts b/src/content.config.ts similarity index 67% rename from src/content/config.ts rename to src/content.config.ts index 63559f4..833a358 100644 --- a/src/content/config.ts +++ b/src/content.config.ts @@ -1,7 +1,8 @@ import { defineCollection, z } from "astro:content"; import { glob } from "astro/loaders"; // Not available with legacy API -const presentations = defineCollection({ +const slides = defineCollection({ + loader: glob({ pattern: "**/*.md", base: "./src/slides" }), schema: z.object({ title: z.string(), description: z.string(), @@ -10,4 +11,4 @@ const presentations = defineCollection({ }), }); -export const collections = { presentations }; +export const collections = { slides }; diff --git a/src/pages/[id].astro b/src/pages/[id].astro new file mode 100644 index 0000000..ff652d6 --- /dev/null +++ b/src/pages/[id].astro @@ -0,0 +1,21 @@ +--- +import SlideLayout from "@layouts/SlideLayout.astro"; +import { getCollection, render } from "astro:content"; + +export const getStaticPaths = async () => + (await getCollection("slides")).map((slide) => ({ + params: { id: slide.id }, + props: { slide }, + })); + +const { slide } = Astro.props; +const { Content } = await render(slide); +--- + + + + diff --git a/src/pages/[slug].astro b/src/pages/[slug].astro deleted file mode 100644 index c9bca3c..0000000 --- a/src/pages/[slug].astro +++ /dev/null @@ -1,21 +0,0 @@ ---- -import SlideLayout from "@layouts/SlideLayout.astro"; -import { getCollection } from "astro:content"; -// 1. Generate a new path for every collection entry -export const getStaticPaths = async () => - (await getCollection("presentations")).map((presentation) => ({ - params: { slug: presentation.slug }, - props: { presentation }, - })); - -const { presentation } = Astro.props; -const { Content } = await presentation.render(); ---- - - - - diff --git a/src/content/presentations/statex-gamedev.md b/src/slides/statex-gamedev.md similarity index 100% rename from src/content/presentations/statex-gamedev.md rename to src/slides/statex-gamedev.md