diff options
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 };
},
});
|
