Skip to main content
This snippet wires Neural Draft into Astro 5 via a content collection loader. The result: type-safe blog content fetched at build time, plus a webhook handler that triggers Vercel/Cloudflare/Netlify rebuilds when something changes.

Install

Shared client

A content collection loader

Astro’s content layer treats Neural Draft like a CMS — pull posts at build time, get type-safe content with Zod validation.

A blog index page

A webhook handler that triggers a rebuild

Astro itself doesn’t trigger rebuilds, but every modern host (Vercel, Netlify, Cloudflare) gives you a “deploy hook” URL. Forward Neural Draft webhooks to that URL.

Hand this to your AI

“Add a /changelog page that lists the last ten published blog posts tagged ‘changelog’. Use the existing nd client from src/lib/neural-draft.ts and call nd.blogPosts.list({ status: 'published', tag: 'changelog', page_size: 10, sort: '-published_at' }). Render every text node with a data-translate key (changelog.title, changelog.description) so the customer can edit copy in the Neural Draft admin.”
With @neuraldraft/mcp installed, the AI will also call register_component to make the new page editable.

Notes

  • This file uses Astro’s content.config.ts — Astro 5 syntax. On 4.x, use the defineCollection({ loader }) style from the experimental content layer.
  • For multi-language sites, add import.meta.env.PUBLIC_LANG and clone the collection per locale.
  • The deploy hook is per-platform: Vercel, Netlify and Cloudflare Pages all expose one in project settings. Free, no rate limit.