adding some sort of articles section

This commit is contained in:
2023-12-22 23:55:42 +01:00
parent 11b3185cea
commit 6e2374e528
22 changed files with 114 additions and 229 deletions

View File

@ -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;
};