diff options
Diffstat (limited to 'src/pages/blog')
| -rw-r--r-- | src/pages/blog/[...slug].astro | 6 | ||||
| -rw-r--r-- | src/pages/blog/index.astro | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 12436c2..eb88f66 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,18 +1,18 @@ --- -import { CollectionEntry, getCollection } from 'astro:content'; +import { CollectionEntry, getCollection, render } from 'astro:content'; import BlogPost from '../../layouts/BlogPost.astro'; export async function getStaticPaths() { const posts = await getCollection('blog'); return posts.map((post) => ({ - params: { slug: post.slug }, + params: { slug: post.id }, props: post, })); } type Props = CollectionEntry<'blog'>; const post = Astro.props; -const { Content } = await post.render(); +const { Content } = await render(post); --- <BlogPost {...post.data}> diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 11201b1..79034d4 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -42,7 +42,7 @@ const posts = (await getCollection('blog')).sort( posts.map((post) => ( <li> <FormattedDate date={post.data.pubDate} /> - <a href={`/blog/${post.slug}/`}>{post.data.title}</a> + <a href={`/blog/${post.id}/`}>{post.data.title}</a> </li> )) } |
