--- import BaseLayout from "../layouts/BaseLayout.astro"; import AuthorList from "../components/AuthorList.astro"; import { formatStoryDate, getPosts, getSiteConfig } from "../lib/content"; import { render } from "astro:content"; export async function getStaticPaths() { const posts = await getPosts(); return posts.map((post) => ({ params: { slug: post.slug }, props: { slug: post.slug }, })); } const site = await getSiteConfig(); const allPosts = await getPosts(); const slugParam = Astro.props?.slug ?? Astro.params.slug; const slug = Array.isArray(slugParam) ? slugParam.join("/") : typeof slugParam === "string" ? slugParam : ""; if (!slug) { throw new Error("Missing slug for story page"); } const post = allPosts.find((entry) => entry.slug === slug); if (!post) { throw new Error(`No story found for slug "${slug}"`); } const { Content } = await render(post.entry); const responseLinks = post.responseTo ?.map((slug) => { const target = allPosts.find((p) => p.slug === slug); return target ? { slug: target.slug, title: target.title, url: target.url } : null; }) .filter(Boolean) ?? []; const followUpLinks = post.followUpTo ?.map((slug) => { const target = allPosts.find((p) => p.slug === slug); return target ? { slug: target.slug, title: target.title, url: target.url } : null; }) .filter(Boolean) ?? []; ---

{post.title}


{ responseLinks.length > 0 && (
This is a response to:
) } { followUpLinks.length > 0 && (
This is a follow-up to:
) } { post.responses && post.responses.length > 0 && (
Responses to this piece:
) } { post.followUps && post.followUps.length > 0 && (
Follow-ups to this piece:
) }