Skip to content

Commit

Permalink
added draft filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jhilker98 committed Sep 30, 2023
1 parent 40415f9 commit 5d3c578
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import HeroSection from "@components/HeroSection.astro";
import { type BlogPost, type Project } from "@content";
import { getCollection } from "astro:content";
const projects: Project[] = await getCollection("projects", ({ data }) => {
return data.featured == true;
return import.meta.env.PROD == true
? data.featured == true && data.draft !== true
: data.featured == true && true;
});
---

Expand Down
4 changes: 3 additions & 1 deletion src/pages/projects/[...page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import { type Project } from "@content/config.ts";
import { getCollection } from "astro:content";
export const getStaticPaths = (async ({ paginate }) => {
const projects = await getCollection("projects");
const projects = await getCollection("projects", ({ data }) => {
return import.meta.env.PROD ? data.draft !== true : true;
});
return paginate(projects, { pageSize: 4 });
}) satisfies GetStaticPaths;
Expand Down

0 comments on commit 5d3c578

Please sign in to comment.