Initial events Astro site
This commit is contained in:
commit
69a5937ead
41 changed files with 12166 additions and 0 deletions
33
src/pages/[year]/[slug]/[page].astro
Normal file
33
src/pages/[year]/[slug]/[page].astro
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
import BarcampPage from "../../../components/BarcampPage.astro";
|
||||
import EventPage from "../../../components/EventPage.astro";
|
||||
import { getEventByParams, getEventPageEntries, internalEvents } from "../../../data/events";
|
||||
|
||||
export function getStaticPaths() {
|
||||
return internalEvents.flatMap((event) =>
|
||||
getEventPageEntries(event)
|
||||
.filter((pageEntry) => pageEntry.type !== "overview")
|
||||
.map((pageEntry) => ({
|
||||
params: {
|
||||
year: event.year,
|
||||
slug: event.slug,
|
||||
page: pageEntry.id,
|
||||
},
|
||||
props: {
|
||||
event,
|
||||
pageEntry,
|
||||
},
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
const { event, pageEntry } = Astro.props;
|
||||
|
||||
if (!event || !pageEntry) {
|
||||
const { year, slug } = Astro.params;
|
||||
const fallbackEvent = getEventByParams(year!, slug!);
|
||||
if (!fallbackEvent) return Astro.redirect("/");
|
||||
}
|
||||
---
|
||||
|
||||
{event.slug === "barcamp" ? <BarcampPage event={event} pageEntry={pageEntry} /> : <EventPage event={event} pageEntry={pageEntry} />}
|
||||
Loading…
Add table
Add a link
Reference in a new issue