diff options
Diffstat (limited to 'src/pages/blog')
| -rw-r--r-- | src/pages/blog/[...slug].astro | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 6dc78ba..8c8aea9 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,7 +1,16 @@ --- import Page from '../../layouts/BlogPost.astro'; -import { getEntry, render } from 'astro:content'; +import { getEntry, getCollection, 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 }, + })) +} + const { slug } = Astro.params; if (slug === undefined) { |
