25 lines
687 B
Text
25 lines
687 B
Text
---
|
|
import { getCollection, render } from 'astro:content';
|
|
import Layout from '../../layouts/Layout.astro';
|
|
import { formatDate } from '../../lib/format';
|
|
import { getSlug } from '../../lib/posts';
|
|
|
|
export async function getStaticPaths() {
|
|
const posts = await getCollection('md', ({ data }) => data.draft !== true);
|
|
return posts.map(post => ({
|
|
params: { slug: getSlug(post.id) },
|
|
props: { post }
|
|
}));
|
|
}
|
|
|
|
const { post } = Astro.props;
|
|
const { Content } = await render(post);
|
|
---
|
|
<Layout title={`${post.data.title} - lewis m.w.`}>
|
|
|
|
<article>
|
|
<h1>{post.data.title}</h1>
|
|
<p class="muted" style="margin-top: 0;">{formatDate(post.data.date)}</p>
|
|
<Content />
|
|
</article>
|
|
</Layout>
|