feat: categories accepts strings & make description optional

This commit is contained in:
草师傅 2025-08-12 11:12:21 +08:00
parent 5ac24d0bc2
commit 70b389a4a5
Signed by: gb
GPG key ID: 43330A030E2D6478
4 changed files with 5 additions and 5 deletions

View file

@ -29,7 +29,7 @@ async function generateMarkdownSection(collectionName, sectionTitle, baseUrl) {
for (const item of sortedItems) {
const { title, description, slug } = getMetaData(item);
markdown += `\n- [${title}](${baseUrl}/blog/${slug}): ${description}`;
markdown += `\n- [${title}](${baseUrl}/blog/${slug}): ${description || ''}`;
}
return markdown;

View file

@ -4,7 +4,7 @@ export async function GET() {
const posts = await getCollection('posts');
const searchIndex = posts.map(post => ({
title: post.data.title,
description: post.data.description,
description: post.data.description || '',
content: post.body,
date: post.data.date,
slug: post.slug