Skip to content

Commit f278f03

Browse files
Merge branch 'ep2025' into ep2025-social-event
2 parents cf711f1 + c2c948a commit f278f03

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/pages/[code].astro

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

src/pages/community-partners.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Layout from "@layouts/SectionLayout.astro";
44
import SponsorCard from "@components/SponsorCard.astro";
55
import Headline from "@ui/Headline.astro";
66
7-
const sponsors = await getCollection("sponsors", ({ data }) => {
7+
const sponsors = (await getCollection("sponsors", ({ data }) => {
88
const isProd = import.meta.env.MODE === "production";
99
const notDraft = !isProd || data.draft !== true;
1010
const isPartner = data.tier === "Partners";
1111
return notDraft && isPartner;
12-
});
12+
})).sort((a, b) => a.id.localeCompare(b.id));
1313
1414
---
1515

src/pages/session/[slug].astro

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function getStaticPaths() {
2121
const sessions = await getCollection("sessions");
2222
2323
const { entry } = Astro.props;
24-
24+
const slug = entry.id;
2525
const speakers = await getEntries(entry.data.speakers);
2626
2727
// Resolve session codes to session data
@@ -233,3 +233,12 @@ const nextSessionsOrdered = sameRoomNextSession
233233
</footer>
234234
</Section>
235235
</Layout>
236+
237+
<script is:inline define:vars={{ slug }}>
238+
const currentUrl = window.location.pathname;
239+
const expectedUrl = `/session/${slug}`;
240+
241+
if (currentUrl !== expectedUrl) {
242+
window.history.replaceState({}, '', expectedUrl);
243+
}
244+
</script>

0 commit comments

Comments
 (0)