Astro is gaining popularity for its speed ⚡ and flexibility in building content-driven websites. One of its experimental features, Live Content Collections, allows developers to fetch content at runtime, rather than pre-generating everything at build time.
This is ideal for projects where content updates frequently, or when you want a CMS-like experience without setting up a full headless CMS.
However, deploying such a project to Netlify with the default static build configuration reveals some important limitations ⚠️.
📝 Understanding Live Content Collections
Astro’s traditional content collections are pre-rendered at build time: Markdown or other content sources are compiled into static HTML. While fast and reliable, these collections are immutable until the next build.
Live Content Collections change that by:
- Fetching and rendering content at request time ⏱️
- Allowing dynamic updates without triggering a full rebuild 🔄
- Enabling integration with APIs or external content sources 🌐
For example, instead of updating a post in WordPress and waiting for a new static build, you could fetch content dynamically with Live Content Collections so that new posts, edits, or custom fields appear instantly on your Astro site without rebuilding.
Official documentation: Astro Live Content Collections
⚠️ The problem with default Netlify deployment
Netlify’s default deployment serves your dist/
folder as static files. This works perfectly for:
- Blogs generated from Markdown
- Marketing pages
- Documentation sites 📚
But any dynamic routing or live content fails:
- Visiting
/blog/post-1
can trigger a 404 ❌ because Netlify expects an actualpost-1/index.html
file - Live Content Collections cannot resolve content dynamically at runtime
Think of it like exporting WordPress to static HTML: it’s fast, but the content no longer updates live.
Reference: Netlify Docs - Deploying static sites
⚡ Why Live Content Collections need server-side rendering (SSR)
Astro supports two output modes:
-
Static (
output: "static"
) → pre-renders all pages at build time 🏗️ -
Server (
output: "server"
) → resolves content dynamically on request 🔄
Live Content Collections require server output, otherwise the site generates HTML files without the ability to fetch content live.
Reference: Astro Docs - Deployment Options
🛠️ Fixing it with the Netlify adapter
To make Live Content Collections work on Netlify:
- Install the official Netlify adapter:
npm install @astrojs/netlify
- Update
astro.config.mjs
:
import { defineConfig } from "astro/config";
import netlify from "@astrojs/netlify";
export default defineConfig({
output: "server",
adapter: netlify(),
});
- Test locally using Netlify CLI:
npm install -g netlify-cli
netlify dev
- Deploy as usual to Netlify. Your site will now serve content dynamically via serverless functions, supporting Live Content Collections and dynamic routes.
Reference: Astro Netlify Adapter Docs
💡 Why this shift matters
Switching from static to server output is more than a config tweak:
- Static mode → like exporting WordPress as HTML: fast but content is frozen ❄️
- Server mode with Netlify → like running WordPress with PHP: dynamic, live updates, fully functional routes 🔄
Live Content Collections become fully usable:
- Content updates appear live without rebuilding 🔄
- Dynamic routing works correctly on Netlify 🌐
- API integrations are seamless 🔌
✅ Conclusion
Netlify’s default static deployment is excellent for purely static Astro sites, but Live Content Collections reveal its limitations.
This setup unlocks a modern workflow that combines Astro’s speed ⚡ with server-side flexibility, giving you a live, dynamic site without sacrificing performance.
References:
Top comments (0)