dependabot/npm_and_yarn/eslint/js-9.39.1
dependabot/npm_and_yarn/eslint-9.39.1
dependabot/npm_and_yarn/eslint-plugin-astro-1.5.0
dependabot/npm_and_yarn/eslint/js-9.39.1
dependabot/npm_and_yarn/katex-0.16.25
dependabot/npm_and_yarn/sharp-0.34.5
dependabot/npm_and_yarn/tailwindcss/vite-4.1.17
dependabot/npm_and_yarn/tsx-4.20.6
dependabot/npm_and_yarn/typescript-eslint-8.46.4
dependabot/npm_and_yarn/typescript-eslint/eslint-plugin-8.36.0
dependabot/npm_and_yarn/typescript-eslint/parser-8.46.4
main
| 1 | --- |
| 2 | import { type CollectionEntry, getCollection } from 'astro:content' |
| 3 | import PostLayout from '@/layouts/PostLayout.astro' |
| 4 | import { render } from 'astro:content' |
| 5 | |
| 6 | export async function getStaticPaths() { |
| 7 | const posts = await getCollection('posts') |
| 8 | return posts |
| 9 | .filter((post) => !post.id.startsWith('_')) |
| 10 | .map((post) => ({ |
| 11 | params: { slug: post.id }, |
| 12 | props: post |
| 13 | })) |
| 14 | } |
| 15 | type Props = CollectionEntry<'posts'> |
| 16 | |
| 17 | const post = Astro.props |
| 18 | const { Content, remarkPluginFrontmatter } = await render(post) |
| 19 | |
| 20 | const readingTime = remarkPluginFrontmatter.readingTime |
| 21 | const toc = remarkPluginFrontmatter.toc || [] |
| 22 | --- |
| 23 | |
| 24 | <PostLayout {...post.data} readingTime={readingTime} toc={toc}> |
| 25 | <Content /> |
| 26 | </PostLayout> |