fix: fix RSS build error

This commit is contained in:
saicaca
2024-09-04 23:13:58 +08:00
parent 4518dbf0f8
commit 1af707ee6a
2 changed files with 4 additions and 5 deletions

View File

@@ -15,13 +15,12 @@ export async function GET(context: APIContext) {
description: siteConfig.subtitle || 'No description',
site: context.site ?? 'https://fuwari.vercel.app',
items: blog.map(post => {
const body = typeof post.data.body === 'string' ? post.data.body : ''
return {
title: post.data.title,
pubDate: post.data.published,
description: post.data.description || '',
link: `/posts/${post.slug}/`,
content: sanitizeHtml(parser.render(body), {
content: sanitizeHtml(parser.render(post.body), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img']),
}),
}