Files
KiraTV---App-Linux/apps/website/src/pages/blog/[...slug].astro
T
2026-05-03 23:43:09 +02:00

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>