From 585e28d49b853155c34a3eba03388722e2049cb7 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 29 Mar 2026 14:10:57 +0200 Subject: feat: add published status to changelog entries --- apps/web/content-collections.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apps/web/content-collections.ts') 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 }; }, }); -- cgit v1.3.1