diff --git a/src/pages/[...slug].astro b/src/pages/[...slug].astro index 88b85d8..f3c1b1b 100644 --- a/src/pages/[...slug].astro +++ b/src/pages/[...slug].astro @@ -4,14 +4,15 @@ import Layout from '@layouts/Layout.astro'; import { slugFromPost } from '@util/slugFromPost'; export async function getStaticPaths() { - const posts = await getCollection('writings'); - return posts.map((post) => { - const slug = slugFromPost(post) - return { - params: { slug }, - props: post - } - }); + return (await getCollection('writings')) + .filter(({ data }) => import.meta.env.PROD ? data.draft !== true : true) + .map((post) => { + const slug = slugFromPost(post) + return { + params: { slug }, + props: post + } + }); } const post = Astro.props;