chore: change the tag schema mapping for supporting more files.

This commit is contained in:
Yufan Sheng 2024-11-28 16:45:56 +08:00
parent 292e17f632
commit 1e322ec952
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B
2 changed files with 8 additions and 6 deletions

View File

@ -110,7 +110,7 @@ database.
If you don't want the astro integration, change the switch in `options.ts` to `false`.
```json
```typescript
{
settings: {
comments: {

View File

@ -61,11 +61,13 @@ export const categories: Category[] = categoriesCollection.map((cat) => ({
permalink: `/cats/${cat.data.slug}`,
...cat.data,
}));
export const tags: Tag[] = tagsCollection[0].data.map((tag) => ({
export const tags: Tag[] = tagsCollection.flatMap((tags) => {
return tags.data.map((tag) => ({
counts: posts.filter((post) => post.tags.includes(tag.name)).length,
permalink: `/tags/${tag.slug}`,
...tag,
}));
});
// Find the missing categories from posts.
const missingCategories: string[] = posts