feat: add full content for rss

This commit is contained in:
KazooTTT
2024-11-23 17:31:46 +08:00
parent 0c6a3e33a0
commit c8c59fa3d4

View File

@ -5,15 +5,24 @@ import { getAllSortedPosts } from '@/utils'
export const GET = async () => {
const posts = await getAllSortedPosts()
const items = await Promise.all(
posts.map(async (post) => {
const entry = post
const body = entry.body
return {
title: post.data.title ?? '',
description: JSON.stringify(body),
pubDate: post.data.date,
link: `/blog/${post.slug}`
}
})
)
return rss({
title: siteConfig.title,
description: siteConfig.description + '\nfeedId:76245438397618182+userId:62156866798228480',
site: import.meta.env.SITE,
items: posts.map((post) => ({
title: post.data.title ?? '',
description: `${post.data.description ?? ''}`,
pubDate: post.data.date,
link: `/blog/${post.slug}`
}))
items
})
}