
Astro 5 Has a Free Content Layer API — The Best Framework for Content Sites
Most frameworks ship 200KB+ of JavaScript to show a blog post. Astro ships zero JS by default. And Astro 5's Content Layer makes content management effortless. What is Astro? Astro is a web framework for building content-driven websites — blogs, docs, marketing sites, portfolios. It renders HTML on the server and ships zero JavaScript unless you explicitly add it. What's New in Astro 5 1. Content Layer API // src/content.config.ts import { defineCollection , z } from ' astro:content ' ; import { glob } from ' astro/loaders ' ; const blog = defineCollection ({ loader : glob ({ pattern : ' **/*.md ' , base : ' ./src/data/blog ' }), schema : z . object ({ title : z . string (), date : z . date (), tags : z . array ( z . string ()), draft : z . boolean (). default ( false ), }), }); export const collections = { blog }; Type-safe content from any source — Markdown, CMS, API, database. 2. Server Islands --- // Static page shell — cached at edge --- <html> <body> <Header /> <main>{staticConte
Continue reading on Dev.to Webdev
Opens in a new tab


