--- import { getCollection, render } from 'astro:content'; import Layout from '../../layouts/Layout.astro'; import { formatDate, formatListItem } 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) : []; ---

{post.data.title}

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

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