Add posts dyno route
This commit is contained in:
14
src/pages/[post].astro
Normal file
14
src/pages/[post].astro
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
// Credit to @rachsmithcodes for this function
|
||||||
|
export async function getStaticPaths() {
|
||||||
|
let posts = await Astro.glob(`./posts/*.md`);
|
||||||
|
return posts.map((post) => ({
|
||||||
|
params: { slug: post.frontmatter.slug },
|
||||||
|
props: { post: post },
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
hey
|
||||||
Reference in New Issue
Block a user