feat: exclude draft posts from public static paths

This commit is contained in:
Lewis Wynne 2026-01-29 01:35:55 +00:00
parent 17ece5a34b
commit 7eaa9c689a

View file

@ -3,7 +3,7 @@ import { getCollection, render } from 'astro:content';
import Layout from '../../layouts/Layout.astro'; import Layout from '../../layouts/Layout.astro';
export async function getStaticPaths() { export async function getStaticPaths() {
const posts = await getCollection('posts'); const posts = await getCollection('posts', ({ data }) => data.draft !== true);
return posts.map(post => ({ return posts.map(post => ({
params: { slug: post.id }, params: { slug: post.id },
props: { post } props: { post }