diff --git a/src/pages/[code].astro b/src/pages/[code].astro new file mode 100644 index 000000000..4f4f2a304 --- /dev/null +++ b/src/pages/[code].astro @@ -0,0 +1,12 @@ +--- +import { getCollection } from "astro:content"; +export async function getStaticPaths() { + const sessions = await getCollection("sessions"); + return sessions.map((entry) => ({ + params: { code: entry.data.code }, + props: { slug: entry.id}, + })); +} +const { slug } = Astro.props; +return Astro.rewrite(`/session/${slug}`); +--- diff --git a/src/pages/session/[slug].astro b/src/pages/session/[slug].astro index dd16dac6c..7ce0f08d1 100644 --- a/src/pages/session/[slug].astro +++ b/src/pages/session/[slug].astro @@ -21,7 +21,7 @@ export async function getStaticPaths() { const sessions = await getCollection("sessions"); const { entry } = Astro.props; - +const slug = entry.id; const speakers = await getEntries(entry.data.speakers); // Resolve session codes to session data @@ -233,3 +233,12 @@ const nextSessionsOrdered = sameRoomNextSession + +