--- import { getCollection, render } from 'astro:content'; import Layout from '../layouts/Layout.astro'; import { formatDate, formatListItem, excerpt } from '../lib/format'; import { getSlug, enrichPostWithDates, enrichPostsWithDates, resolveRelatedPosts } from '../lib/md'; export async function getStaticPaths() { const rawPosts = await getCollection('md'); const allPosts = enrichPostsWithDates(rawPosts); return allPosts.map(post => ({ params: { slug: getSlug(post.id) }, props: { post, allPosts } })); } const { post, allPosts } = Astro.props; const { Content } = await render(post); const related = post.data.related ? resolveRelatedPosts(post.data.related, allPosts) : []; const description = excerpt((post as any).body) || undefined; ---

{post.data.title}

{formatDate(post.dates.created)}{post.dates.updated && ` (updated ${formatDate(post.dates.updated)})`}

{related.length > 0 && (
 formatListItem(p.dates.created, `/${getSlug(p.id)}`, p.data.title)).join('\n')} />
  
)}