--- // src/pages/blog/index.astro export const prerender = true; import BaseLayout from '../../layouts/BaseLayout.astro'; import NewsletterSignup from '../../components/NewsletterSignup.jsx'; import { getCollection } from 'astro:content'; const posts = await getCollection('blog'); --- --- // src/pages/blog/[slug].astro export const prerender = true; // ...rest unchanged from Challenge 1, still using getStaticPaths() // src/pages/api/subscribe.ts — no prerender export, stays dynamic export async function POST({ request }) { const { email } = await request.json(); return new Response(JSON.stringify({ status: 'ok' }), { headers: { 'Content-Type': 'application/json' }, }); } Steps to confirm: 1. Run npm run build with the project's own astro.config.mjs still set to output: 'server'. 2. Inspect the build output: blog/index.html and blog//index.html exist as real pre-rendered static files, thanks to prerender = true on both pages. 3. api/subscribe has no equivalent static file - it's still handled live by the Node server at request time, since it never opted into prerender = true. Notes: - This is the finer-grained alternative the chapter's own tip-box raised: rather than making the whole project dynamic just because one endpoint needs to be, only subscribe.ts pays that cost, while the genuinely static blog content keeps the performance and simplicity of pre-rendered HTML. - getStaticPaths() is still required on [slug].astro specifically because that page is prerendered - the requirement follows the per-page rendering mode, not the project's own overall output setting.