Skip to content

Commit fd7b2a9

Browse files
authored
Merge pull request #27 from ansidev/feature/page-post
Page: /{slug}
2 parents aa78b83 + c0e5f89 commit fd7b2a9

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/layouts/PostLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ const { author } = siteConfig
3535

3636
<style lang="css">
3737
.post {
38-
@apply grid grid-cols-1 mx-auto my-8 p-4 max-w-5xl;
38+
@apply grid grid-cols-1 mx-auto my-8 p-4 xl:px-0 max-w-5xl;
3939
}
4040
</style>

src/pages/[slug].astro

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
import { CollectionEntry, getCollection } from 'astro:content'
3+
4+
import PostLayout from '@/layouts/PostLayout.astro'
5+
6+
export async function getStaticPaths() {
7+
const allPosts = await getCollection('leetcode-solutions')
8+
return allPosts.map((entry) => ({
9+
params: {
10+
slug: entry.slug,
11+
},
12+
props: {
13+
entry,
14+
},
15+
}))
16+
}
17+
18+
type Props = CollectionEntry<'leetcode-solutions'>
19+
20+
const { entry } = Astro.props
21+
const { Content } = await entry.render()
22+
---
23+
24+
<PostLayout frontmatter={entry.data}>
25+
<Content />
26+
</PostLayout>

0 commit comments

Comments
 (0)