Skip to content

Draft Filtering

scribe sets draft: true for unpublished posts. Astro does not filter drafts automatically.

const allPosts = await getCollection('posts');
const posts = allPosts.filter(p => !p.data.draft);
export async function getStaticPaths() {
const posts = await getCollection('posts');
return posts
.filter(p => !p.data.draft)
.map(post => ({
params: { slug: post.id },
props: { post },
}));
}