From 7eff3fde5720eb23449e2f8c8ea0b8218efe4dde Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Wed, 4 Sep 2024 21:16:37 +0000 Subject: Initial Astro project --- src/pages/blog/[...slug].astro | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/pages/blog/[...slug].astro (limited to 'src/pages/blog') diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro new file mode 100644 index 0000000..c94fe52 --- /dev/null +++ b/src/pages/blog/[...slug].astro @@ -0,0 +1,20 @@ +--- +import { type CollectionEntry, getCollection } from "astro:content"; +import Layout from "../../layouts/PostLayout.astro"; + +export async function getStaticPaths() { + const posts = await getCollection("blog"); + return posts.map((post) => ({ + params: { slug: post.slug }, + props: post, + })); +} +type Props = CollectionEntry<"blog">; + +const post = Astro.props; +const { Content } = await post.render(); +--- + + + + -- cgit v1.2.3