fix: MarkdownIt String error when md file body is empty (#303)

* Fix: MarkdownIt String error

Fixed MardownIt String error that occurs when a md file body is empty

* fix dependabot.yml

* fix parsing error

* refactor: simplify content handling in RSS feed generation

---------

Co-authored-by: アピヌ <apynu@users.noreply.github.com>
Co-authored-by: L4Ph <4ranci0ne@gmail.com>
Co-authored-by: Katsuyuki Karasawa <me@l4ph.moe>
This commit is contained in:
アピヌ
2025-03-30 18:32:05 +02:00
committed by GitHub
parent 7a5ea7a1b3
commit 92c659a7b8

View File

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