Skip to content

Commit a429bd7

Browse files
committed
Short urls for sessions.
1 parent 5a2dec9 commit a429bd7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/pages/[code].astro

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
4+
export async function getStaticPaths() {
5+
const sessions = await getCollection("sessions");
6+
return sessions.map((entry) => ({
7+
params: { code: entry.data.code },
8+
props: { slug: entry.id},
9+
}));
10+
}
11+
12+
const { slug } = Astro.props;
13+
14+
---
15+
16+
<meta http-equiv="refresh" content=`0;url=/session/${slug}` />

0 commit comments

Comments
 (0)