Skip to content

Commit

Permalink
Merge pull request #40 from kuzudb/blog-unpublish
Browse files Browse the repository at this point in the history
Fix draft arguments
  • Loading branch information
prrao87 authored Mar 28, 2024
2 parents 0403d74 + 4fbfe41 commit 5285f2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const post = defineCollection({
categories: z.array(z.string()).default(['others']),
tags: z.array(z.string()).default(['others']),
authors: z.array(z.any()).default(['team']),
draft: z.boolean().default(false),
}),
});

Expand Down
4 changes: 3 additions & 1 deletion src/pages/[...page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import Pagination from "@components/Pagination.astro";
import config from "@config/config.json";
export async function getStaticPaths({ paginate }) {
const allPosts = await getCollection("post");
const allPosts = await getCollection('post', ({ data }) => {
return data.draft !== true;
});
const formattedPosts = allPosts.sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
);
Expand Down

0 comments on commit 5285f2c

Please sign in to comment.