惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
V
Vulnerabilities – Threatpost
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
B
Blog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
H
Hacker News: Front Page
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园_首页
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
W
WeLiveSecurity
N
News and Events Feed by Topic
F
Fortinet All Blogs
PCI Perspectives
PCI Perspectives
WordPress大学
WordPress大学
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Recent Announcements
Recent Announcements
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hacker News: Ask HN
Hacker News: Ask HN
爱范儿
爱范儿
腾讯CDC
Last Week in AI
Last Week in AI
月光博客
月光博客
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Help Net Security
Help Net Security
V
V2EX
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
H
Heimdal Security Blog
L
LINUX DO - 最新话题
GbyAI
GbyAI
The Hacker News
The Hacker News
罗磊的独立博客
S
SegmentFault 最新的问题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 【当耐特】
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V2EX - 技术
V2EX - 技术
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
O
OpenAI News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro 5.7 Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 Astro 5.5 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands Zero-JavaScript View Transitions Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 Astro 4.6 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB Astro 4.5
The Astro Content Layer
Fred Schott · 2024-06-12 · via The Astro Blog

This is Part 2 of our series on “The Future of Astro”, covering three major advancements we have planned for the Astro web framework in 2024. This post introduces a more powerful Content Layer to Astro: a new way to work with your local and remote content sources.

In Astro 2.0, we released the original Content Collections API. Content Collections were designed around our own experiences and frustrations struggling to scale up large Markdown projects in modern web frameworks, including Astro at the time. Our goal was to make it easier to work with local content (Markdown, MDX, etc.) in Astro than any other web framework.

Content Collections brought built-in content management features to Astro like content schemas, frontmatter validation, and a fully TypeScript-enabled query API:

import { getCollection, getEntry } from 'astro:content';

// Get all entries from a collection.

// Requires the name of the collection as an argument.

// Example: retrieve `src/content/blog/**`

const allBlogPosts = await getCollection('blog');

// Get a single entry from a collection via the request URL.

// Requires the name of the collection and an entry ID slug.

// Example: retrieve `src/content/blog/future-of-astro-content-layer.mdx`

const blogPostEntry = await getEntry('blog', Astro.params.slug);

Content is an essential primitive in Astro. But building content-driven websites with Astro should be easy no matter where your content lives. We already solved this for local Markdown, now what about larger projects where content lives outside of your repo? In a remote API? In your favorite CMS?

We are beginning to explore a new, more powerful Content Layer API for Astro. The new Content Layer will build on our existing Content Collections functionality to make working with your content in Astro easier than ever before. Lets dive into how it works.

A More Powerful Content Engine

One of the current limitations of Content Collections is that our current data structure is stored entirely in memory. This works well enough for static sites, but loading all of that data into memory can wreak havoc on cold-start times in serverless SSR environments.

We are currently exploring LibSQL (SQLite) as a new underlying storage mechanism for content in Astro. By embedding SQLite inside of Astro, we could scale up to millions of content entries in a project without breaking a sweat. Plus, SQLite’s file storage would dramatically speed up both development and build performance by allowing us to cache content across builds.

For developers, direct access to a SQL database would also introduce more powerful query API for those who need it. We specifically designed our own getCollection and getEntry APIs to be intentionally simple, and these APIs aren’t going anywhere. However, this has always left the responsibility of filtering and sorting to the user. An internal SQL database would help us bridge that gap and offer more advanced built-in querying to anyone who needs it.

A More Flexible Content Source

Breaking content out of the current src/content directory requires rethinking how we define collections in Astro. Instead of a hard-coded filesystem loader like the one built into Astro today, we are exploring a new, more flexible data loader for the defineCollection() API.

defineCollection({

name: 'my-portfolio',

data: (db: DB, watcher: FileSystemWatcher) => {

// 1. fetch your data

// 2. insert it into the database

// 3. optional: handle content updates during development

// (a file change, CMS websocket notification)

},

})

With this new API, you can:

  • Read files from the file system (like we already do today)
  • Provide a simple array of hardcoded, inline data
  • Load data from a remote API using fetch()
  • Load content from an external CMS like Storyblok

This will also enable composability across the larger Astro developer ecosystem. Anyone can publish a loader to npm. As an Astro developer, that means that you will be able to leverage a community ecosystem full of pluggable and reusable content loaders.

// Example: An (imagined) Instagram profile loader for Astro

import instagram from 'some-instagram-astro-content-loader';

defineCollection({

name: 'my-portfolio',

data: instagram({ /* ... */ }),

})

We’ll be exploring this pluggable ecosystem story in parallel with the new Content Layer API. We are excited to give Astro users something that will unlock entirely new opportunities for composable content without sacrificing the ease of our current built-in Markdown support that you know and love.

Next Steps

Keep an eye out for experimental support coming to Astro later this year. We often launch new features behind experimental flags before they are stable, which gives our developer community plenty of time to try out new APIs and leave feedback.

To learn more about the Content Layer proposal and leave early feedback, you can visit the ongoing discussion in our open roadmap repo. We’ll continue to post updates there and in our Discord as we begin work on the official implementation.