export async function getPosts() { const allPostFiles = import.meta.glob('$content/post/*.md'); const iterablePostFiles = Object.entries(allPostFiles); const allPosts = await Promise.all( iterablePostFiles.map(async ([pathMarkdown, resolver]) => { const { metadata } = await resolver(); const pathPost = "/post/" + pathMarkdown.slice(pathMarkdown.lastIndexOf("/") + 1, -".md".length); return { meta: { ...metadata, date: new Date(metadata.date), }, path: pathPost }; }) ); allPosts.sort((post1, post2) => { const date1: Date = post1.meta.date; const date2: Date = post2.meta.date; return date2.getTime() - date1.getTime(); }); return allPosts; }