roadmap
roadmap copied to clipboard
Live content collections
Summary
Adds support for live data to content collections. Defines a new type of content loader that fetches data at runtime rather than build time, allowing users to get the data with a similar API.
import { defineCollection } from "astro:content";
const products = defineCollection({
type: "live",
loader: {
name: "store-loader",
loadCollection: async ({ filter }) => {
// ...
return {
entries: products.map((product) => ({
id: product.id,
data: product,
})),
};
},
loadEntry: async ({ filter }) => {
// ...
return {
id: filter.id,
data: product,
};
},
};
});
export const collections = { products };