feat: exclude draft posts from public static paths
This commit is contained in:
parent
17ece5a34b
commit
7eaa9c689a
1 changed files with 1 additions and 1 deletions
|
|
@ -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 }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue