feat: drafts frontmatter & exclude drafts from production
This commit is contained in:
parent
bfd3bef223
commit
ca28bd2d36
12 changed files with 34 additions and 11 deletions
|
@ -1,7 +1,9 @@
|
|||
import { getCollection } from 'astro:content';
|
||||
|
||||
export async function GET() {
|
||||
const posts = await getCollection('posts');
|
||||
const posts = await getCollection('posts', ({ data }) => {
|
||||
return import.meta.env.PROD ? data.draft !== true : true;
|
||||
});
|
||||
const searchIndex = posts.map(post => ({
|
||||
title: post.data.title,
|
||||
description: post.data.description || '',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue