21 lines
409 B
TypeScript
21 lines
409 B
TypeScript
import { createContentLoader } from "vitepress";
|
|
|
|
interface Index {
|
|
title: string;
|
|
url: string;
|
|
}
|
|
|
|
declare const data: Index[];
|
|
|
|
export { data };
|
|
|
|
export default createContentLoader("*.md", {
|
|
transform(raw): Index[] {
|
|
return raw
|
|
.map(({ url, frontmatter, excerpt }) => ({
|
|
title: frontmatter.title,
|
|
url,
|
|
}))
|
|
.sort((a, b) => a.title.localeCompare(b.title));
|
|
},
|
|
});
|