ContentParser && Tabs Updated

This commit is contained in:
Al Murad Uzzaman
2025-04-29 11:13:55 +06:00
parent 423ad81a1c
commit 68c865c652
5 changed files with 32 additions and 17 deletions
+15 -1
View File
@@ -5,12 +5,26 @@ import {
type CollectionKey,
} from "astro:content";
type PageData = {
title: string;
meta_title?: string;
description?: string;
image?: string;
draft?: boolean;
};
export const getSinglePage = async <C extends CollectionKey>(
collectionName: C
): Promise<CollectionEntry<C>[]> => {
const allPages = await getCollection(collectionName);
const removeIndex = allPages.filter((data) => data.id.match(/^(?!-)/));
const removeDrafts = removeIndex.filter((data) => !data.data.draft);
const removeDrafts = removeIndex.filter((data) => {
const pageData = data.data as PageData;
return pageData.draft !== true;
});
return removeDrafts;
};
---