mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-19 14:43:29 +09:00
ContentParser && Tabs Updated
This commit is contained in:
@@ -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;
|
||||
};
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user