28 lines
723 B
Plaintext
28 lines
723 B
Plaintext
---
|
|
import { type CollectionEntry, getCollection } from "astro:content";
|
|
import PostDetails from "@/layouts/PostDetails.astro";
|
|
import getSortedPosts from "@/utils/getSortedPosts";
|
|
import { getPath } from "@/utils/getPath";
|
|
|
|
type Props = {
|
|
post: CollectionEntry<"events">;
|
|
};
|
|
|
|
export async function getStaticPaths() {
|
|
const posts = await getCollection("events", ({ data }) => !data.draft);
|
|
const postResult = posts.map(post => ({
|
|
params: { slug: getPath(post.id, post.filePath, false) },
|
|
props: { post },
|
|
}));
|
|
|
|
return postResult;
|
|
}
|
|
|
|
const { post } = Astro.props;
|
|
|
|
const posts = await getCollection("events");
|
|
const sortedPosts = getSortedPosts(posts);
|
|
---
|
|
|
|
<PostDetails post={post} posts={sortedPosts} />
|