From c8c59fa3d42dfe47225bce51e93f4af98b982353 Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Sat, 23 Nov 2024 17:31:46 +0800 Subject: [PATCH] feat: add full content for rss --- src/pages/rss.xml.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index 0ddab5d..f5866f5 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -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 }) }