diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-29 14:10:57 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:58:46 +0200 |
| commit | 585e28d49b853155c34a3eba03388722e2049cb7 (patch) | |
| tree | 92efed21fe58b812de7c7f83dc373d9594e1734c /apps/web/content-collections.ts | |
| parent | 1261e663e1bbb950e4efc8927ca4b068e0946bae (diff) | |
| download | opencut-585e28d49b853155c34a3eba03388722e2049cb7.tar.gz | |
feat: add published status to changelog entries
Diffstat (limited to 'apps/web/content-collections.ts')
| -rw-r--r-- | apps/web/content-collections.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/web/content-collections.ts b/apps/web/content-collections.ts index b9904bf6..bde2ba94 100644 --- a/apps/web/content-collections.ts +++ b/apps/web/content-collections.ts @@ -9,6 +9,7 @@ const changelog = defineCollection({ content: z.string(),
version: z.string(),
date: z.string(),
+ published: z.boolean().default(true),
title: z.string(),
description: z.string().optional(),
changes: z.array(
@@ -20,10 +21,11 @@ const changelog = defineCollection({ }),
transform: async (doc, { collection }) => {
const allDocs = await collection.documents();
- const sorted = [...allDocs].sort((a, b) =>
+ const publishedDocs = allDocs.filter((entry) => entry.published !== false);
+ const sorted = [...publishedDocs].sort((a, b) =>
b.version.localeCompare(a.version, undefined, { numeric: true }),
);
- const isLatest = sorted[0]?.version === doc.version;
+ const isLatest = doc.published !== false && sorted[0]?.version === doc.version;
return { ...doc, isLatest };
},
});
|
