Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/layouts/PostLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ const { author } = siteConfig

<style lang="css">
.post {
@apply grid grid-cols-1 mx-auto my-8 p-4 max-w-5xl;
@apply grid grid-cols-1 mx-auto my-8 p-4 xl:px-0 max-w-5xl;
}
</style>
26 changes: 26 additions & 0 deletions src/pages/[slug].astro
Original file line number Diff line number Diff line change
@@ -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()
---

<PostLayout frontmatter={entry.data}>
<Content />
</PostLayout>