diff options
Diffstat (limited to 'src/pages/blog')
| -rw-r--r-- | src/pages/blog/[...slug].astro | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 6dc78ba..bd9ac7f 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,7 +1,17 @@ --- import Page from '../../layouts/BlogPost.astro'; -import { getEntry, render } from 'astro:content'; +import { getCollection, CollectionEntry, getEntry, render } from 'astro:content'; import { formatDate } from "../../util"; + +export async function getStaticPaths() { + const posts = await getCollection('blog') + return posts.map((post) => ({ + params: { slug: post.id }, + props: { post }, + })) +} +type Props = CollectionEntry<'blog'>; + const { slug } = Astro.params; if (slug === undefined) { |
