From 5f0fb494875cfb1d207f8739ef41b340d6cb6228 Mon Sep 17 00:00:00 2001 From: Jacob Hilker Date: Mon, 23 Oct 2023 19:14:03 -0400 Subject: [PATCH] added draft filter --- src/pages/categories/index.astro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/categories/index.astro b/src/pages/categories/index.astro index 9b290b07..4c5a268d 100644 --- a/src/pages/categories/index.astro +++ b/src/pages/categories/index.astro @@ -2,7 +2,9 @@ import BaseLayout from "@layouts/BaseLayout.astro"; import { slugifyUrl } from "@lib/utils"; import { getCollection, type CollectionEntry } from "astro:content"; -const posts: CollectionEntry<"blog">[] = await getCollection("blog"); +const posts: CollectionEntry<"blog">[] = await getCollection("blog", {data} => { + return import.meta.env.PROD ? data.draft !== true : true +}); const categories = posts .map((post) => post.data.categories?.map((cat) => cat.toLowerCase())) .flat()