Complete the code to define a content collection in Astro.
export const blog = defineCollection({ schema: [1] });The schema defines the structure of content using z.object in Astro collections.
Complete the code to fetch all entries from a content collection.
const posts = await getCollection([1]);You fetch entries by specifying the collection name, here 'blog'.
Fix the error in this code to access a field from a content entry.
const title = post.data.[1];The field title is accessed from the data object of a post.
Fill both blanks to create a filtered list of posts with titles longer than 5 characters.
const filtered = posts.filter(post => post.data.title.length [1] 5 && post.data.title [2] '');
We check if the title length is greater than 5 and the title is not empty.
Fill all three blanks to map posts to an array of objects with title, slug, and date.
const summary = posts.map(post => ({ title: post.data.[1], slug: post.[2], date: post.data.[3] }));This maps each post to an object with its title, slug, and date fields.
