MP4 格式解析
export const getPosts = async (): Promise<PostSummary[]> => {
const modules = await import.meta.glob("/src/routes/posts/**/index.md");
const posts = await asyncMap(Object.keys(modules), async (path) => {
const data = (await modules[path]()) as DocumentHeadProps;
return {
title: data.head.title || "",
description:
data.head.meta.find((m) => m.name === "description")?.content || "",
date: data.head.frontmatter.date as string,
permalink: data.head.frontmatter.permalink as string,
};
});
return posts.sort((a, b) => {
const dateA = new Date(a.date as string).getTime();
const dateB = new Date(b.date as string).getTime();
return dateB - dateA;
});
};