From a429bd7059e7ba4465baf4769f04e2d879e2ff88 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 13 May 2025 15:18:31 +0200 Subject: [PATCH 1/5] Short urls for sessions. --- src/pages/[code].astro | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/pages/[code].astro diff --git a/src/pages/[code].astro b/src/pages/[code].astro new file mode 100644 index 000000000..e72342966 --- /dev/null +++ b/src/pages/[code].astro @@ -0,0 +1,16 @@ +--- +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; + +--- + + From b5782fab1f5a8ce36a5f3d4f477b5a94c43e9153 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 13 May 2025 15:34:01 +0200 Subject: [PATCH 2/5] Add 301 redirects. --- astro.config.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/astro.config.mjs b/astro.config.mjs index a443f3246..4d4535ded 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -76,6 +76,7 @@ export default defineConfig({ redirects: { "/planning/": "https://forms.gle/riw6CvML8ck94A4V9", "/reviewers/": "https://forms.gle/4GTJjwZ1nHBGetM18", + "/[code]": "/session/[...slug]", }, integrations: [ preload(), From f6feda741f6070dcb78d1c96b9e1e6eee2cfbc30 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 13 May 2025 16:03:05 +0200 Subject: [PATCH 3/5] Add rewrite. --- astro.config.mjs | 1 - src/pages/[code].astro | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 4d4535ded..a443f3246 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -76,7 +76,6 @@ export default defineConfig({ redirects: { "/planning/": "https://forms.gle/riw6CvML8ck94A4V9", "/reviewers/": "https://forms.gle/4GTJjwZ1nHBGetM18", - "/[code]": "/session/[...slug]", }, integrations: [ preload(), diff --git a/src/pages/[code].astro b/src/pages/[code].astro index e72342966..2f077b3aa 100644 --- a/src/pages/[code].astro +++ b/src/pages/[code].astro @@ -10,7 +10,5 @@ export async function getStaticPaths() { } const { slug } = Astro.props; - +return Astro.rewrite(`/session/${slug}`); --- - - From 6f791cf0951fb9b03e60812f259e53b64de41f1b Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 13 May 2025 18:05:50 +0200 Subject: [PATCH 4/5] Add rewrite. --- src/pages/[code].astro | 2 -- src/pages/session/[slug].astro | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pages/[code].astro b/src/pages/[code].astro index 2f077b3aa..4f4f2a304 100644 --- a/src/pages/[code].astro +++ b/src/pages/[code].astro @@ -1,6 +1,5 @@ --- import { getCollection } from "astro:content"; - export async function getStaticPaths() { const sessions = await getCollection("sessions"); return sessions.map((entry) => ({ @@ -8,7 +7,6 @@ export async function getStaticPaths() { 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..afb97658d 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,16 @@ const nextSessionsOrdered = sameRoomNextSession + + From 43021be82cf809da15581cd5262b807de54753f0 Mon Sep 17 00:00:00 2001 From: Niko Date: Tue, 13 May 2025 18:10:36 +0200 Subject: [PATCH 5/5] Clean up. --- src/pages/session/[slug].astro | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/pages/session/[slug].astro b/src/pages/session/[slug].astro index afb97658d..7ce0f08d1 100644 --- a/src/pages/session/[slug].astro +++ b/src/pages/session/[slug].astro @@ -235,14 +235,10 @@ const nextSessionsOrdered = sameRoomNextSession