feat: add front-matter variable category

This commit is contained in:
saicaca
2023-11-07 12:35:52 +08:00
parent 2b000f7e55
commit b171ad463e
10 changed files with 22 additions and 8 deletions

View File

@@ -60,6 +60,9 @@ export async function getCategoryMap(): Promise<CategoryMap> {
let root: CategoryMap = {};
allBlogPosts.map((post) => {
let current = root;
if (post.data.category) {
post.data.categories = [post.data.category];
}
if (!post.data.categories)
return;
for (const c of post.data.categories) {