diff options
Diffstat (limited to 'src/data/post.ts')
| -rw-r--r-- | src/data/post.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/data/post.ts b/src/data/post.ts index c7df82f..7cadb93 100644 --- a/src/data/post.ts +++ b/src/data/post.ts @@ -1,11 +1,15 @@ import { type CollectionEntry, getCollection } from "astro:content"; -/** filter out draft posts based on the environment and optionally archived posts */ -export async function getAllPosts(includeArchived = false): Promise<CollectionEntry<"post">[]> { +/** filter out draft posts based on the environment and optionally archived posts and micro posts */ +export async function getAllPosts( + includeArchived = false, + includeMicro = false, +): Promise<CollectionEntry<"post">[]> { return await getCollection("post", ({ data }) => { const isDraftFilter = import.meta.env.PROD ? !data.draft : true; const isArchivedFilter = includeArchived || !data.tags.includes("archived"); - return isDraftFilter && isArchivedFilter; + const isMicroFilter = includeMicro || !data.tags.includes("micro"); + return isDraftFilter && isArchivedFilter && isMicroFilter; }); } |
