diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 15:31:19 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 15:39:07 +0100 |
| commit | 52411f6cb9efc10dd683096b34e5c279a11f7e0a (patch) | |
| tree | fd5e71902fbebe2e3f014c7ebb5f153fc8c7d1e7 /src/data/post.ts | |
| parent | 26ffc44ee72522891b4fdacac15134dfcf9c4859 (diff) | |
Rework how tags are working and make them native
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; }); } |
