--- import { getCollection, getEntry, type CollectionEntry, type CollectionKey, } from "astro:content"; type PageData = { title: string; meta_title?: string; description?: string; image?: string; draft?: boolean; }; export const getSinglePage = async ( collectionName: C ): Promise[]> => { const allPages = await getCollection( collectionName, ({ data, id }) => !(data as PageData)?.draft && !id.startsWith("-") ); return allPages; }; export const getListPage = async ( collectionName: C, documentId: "-index" | string ): Promise> => { const data = (await getEntry( collectionName, documentId )) as CollectionEntry | null; if (!data) { throw new Error( `No page found for the collection: ${collectionName} with filename: ${documentId}` ); } return data; }; ---