diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index cf3789c3..88821a18 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -35,6 +35,6 @@ const { author } = siteConfig diff --git a/src/pages/[slug].astro b/src/pages/[slug].astro new file mode 100644 index 00000000..fc2934ac --- /dev/null +++ b/src/pages/[slug].astro @@ -0,0 +1,26 @@ +--- +import { CollectionEntry, getCollection } from 'astro:content' + +import PostLayout from '@/layouts/PostLayout.astro' + +export async function getStaticPaths() { + const allPosts = await getCollection('leetcode-solutions') + return allPosts.map((entry) => ({ + params: { + slug: entry.slug, + }, + props: { + entry, + }, + })) +} + +type Props = CollectionEntry<'leetcode-solutions'> + +const { entry } = Astro.props +const { Content } = await entry.render() +--- + + + +