adding some sort of articles section
This commit is contained in:
@ -5,9 +5,20 @@ export const shuffleArray = (array: any[]) => {
|
||||
}
|
||||
};
|
||||
|
||||
function changePage(pages: any, pageName: string): void {
|
||||
const pageKey = pageName.toLowerCase();
|
||||
if (pages[pageKey as keyof typeof pages]) {
|
||||
active_page = pages[pageKey as keyof typeof pages];
|
||||
}
|
||||
}
|
||||
export const fetchMarkdownGuides = async () => {
|
||||
const allPostFiles = import.meta.glob('/src/routes/guides/*.md');
|
||||
const iterablePostFiles = Object.entries(allPostFiles);
|
||||
|
||||
const allPosts = await Promise.all(
|
||||
iterablePostFiles.map(async ([path, resolver]) => {
|
||||
const { metadata } = await (resolver() as Promise<{ metadata: any }>);
|
||||
const postPath = path.slice(11, -3);
|
||||
return {
|
||||
meta: metadata,
|
||||
path: postPath
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
return allPosts;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user