33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
---
|
|
import type { GetStaticPaths } from "astro";
|
|
import { getCollection } from "astro:content";
|
|
import Main from "@/layouts/Main.astro";
|
|
import Layout from "@/layouts/Layout.astro";
|
|
import Header from "@/components/Header.astro";
|
|
import Footer from "@/components/Footer.astro";
|
|
import Card from "@/components/Card.astro";
|
|
import Pagination from "@/components/Pagination.astro";
|
|
import getSortedPosts from "@/utils/getSortedPosts";
|
|
import { SITE } from "@/config";
|
|
|
|
export const getStaticPaths = (async ({ paginate }) => {
|
|
const events = await getCollection("events", ({ data }) => !data.draft);
|
|
return paginate(getSortedPosts(events), { pageSize: SITE.postPerPage });
|
|
}) satisfies GetStaticPaths;
|
|
|
|
const { page } = Astro.props;
|
|
---
|
|
|
|
<Layout title={`Events | ${SITE.title}`}>
|
|
<Header />
|
|
<Main pageTitle="Events" pageDesc="All upcoming and past events organized by HEC IA.">
|
|
<ul>
|
|
{page.data.map(data => <Card {...data} />)}
|
|
</ul>
|
|
</Main>
|
|
|
|
<Pagination {page} />
|
|
|
|
<Footer noMarginTop={page.lastPage > 1} />
|
|
</Layout>
|