Skip to content

Commit

Permalink
added draft filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jhilker98 committed Oct 23, 2023
1 parent 7c77871 commit 5f0fb49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/categories/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5f0fb49

Please sign in to comment.