31 lines
781 B
Plaintext
31 lines
781 B
Plaintext
---
|
|
import { getCollection, render } from 'astro:content';
|
|
import BlogPost from '../../layouts/BlogPost.astro';
|
|
|
|
export async function getStaticPaths() {
|
|
const includeDrafts = import.meta.env.DEV || import.meta.env.PUBLIC_INCLUDE_DRAFTS === 'true';
|
|
const posts = await getCollection('blog');
|
|
return posts
|
|
.filter((post) => includeDrafts || !post.data.draft)
|
|
.map((post) => ({
|
|
params: { slug: post.id },
|
|
props: post,
|
|
}));
|
|
}
|
|
|
|
const post = Astro.props;
|
|
const { Content } = await render(post);
|
|
---
|
|
|
|
<BlogPost
|
|
title={post.data.title}
|
|
description={post.data.description}
|
|
pubDate={post.data.pubDate}
|
|
updatedDate={post.data.updatedDate}
|
|
author={post.data.author}
|
|
tags={post.data.tags}
|
|
heroImage={post.data.heroImage}
|
|
>
|
|
<Content />
|
|
</BlogPost>
|