From 03c6141d2ee96b72ba06d5211c98a4d28b912819 Mon Sep 17 00:00:00 2001 From: Le Minh Tri Date: Sat, 25 Feb 2023 22:22:52 +0700 Subject: [PATCH 1/2] fix(layout): adjust padding-x --- src/layouts/PostLayout.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c0e5f898b78202fcd53947622efb26e8c43ec5d9 Mon Sep 17 00:00:00 2001 From: Le Minh Tri Date: Sat, 25 Feb 2023 22:19:16 +0700 Subject: [PATCH 2/2] feat(page): add page /{slug} --- src/pages/[slug].astro | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/pages/[slug].astro 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() +--- + + + +