mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-12 07:12:52 +01:00
feat: remove support for nested categories
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
---
|
||||
|
||||
import {getSortedPosts} from "../../../utils/content-utils";
|
||||
import {getCategoryList, getSortedPosts} from "../../../utils/content-utils";
|
||||
import MainGridLayout from "../../../layouts/MainGridLayout.astro";
|
||||
import ArchivePanel from "../../../components/ArchivePanel.astro";
|
||||
import {i18n} from "../../../i18n/translation";
|
||||
@@ -8,21 +7,11 @@ import I18nKey from "../../../i18n/i18nKey";
|
||||
|
||||
|
||||
export async function getStaticPaths() {
|
||||
let posts = await getSortedPosts()
|
||||
|
||||
const allCategories = posts.reduce((acc, post) => {
|
||||
if (!Array.isArray(post.data.categories))
|
||||
return acc;
|
||||
post.data.categories.forEach(category => acc.add(category));
|
||||
return acc;
|
||||
}, new Set());
|
||||
|
||||
const allCategoriesArray = Array.from(allCategories);
|
||||
|
||||
return allCategoriesArray.map(category => {
|
||||
const categories = await getCategoryList();
|
||||
return categories.map(category => {
|
||||
return {
|
||||
params: {
|
||||
category: category
|
||||
category: category.name
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,6 @@ const {page} = Astro.props;
|
||||
entry={entry}
|
||||
title={entry.data.title}
|
||||
tags={entry.data.tags}
|
||||
categories={entry.data.categories}
|
||||
category={entry.data.category}
|
||||
published={entry.data.published}
|
||||
url={getPostUrlBySlug(entry.slug)}
|
||||
|
||||
@@ -64,7 +64,7 @@ const { remarkPluginFrontmatter } = await entry.render();
|
||||
class="mb-5"
|
||||
published={entry.data.published}
|
||||
tags={entry.data.tags}
|
||||
categories={entry.data.categories}
|
||||
category={entry.data.category}
|
||||
></PostMetadata>
|
||||
|
||||
<!-- always show cover as long as it has one -->
|
||||
|
||||
Reference in New Issue
Block a user