From b32c5bc6e9352bfd6a12b7b10d78f5a7de038370 Mon Sep 17 00:00:00 2001 From: passthem Date: Wed, 1 Apr 2026 02:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20RSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/rss.xml.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index aae61aa..68622f4 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -6,7 +6,7 @@ import { type ListBlogItemType, } from '../lib/apis/legacy/blog' import { ensureShikiEngine } from '../lib/markdown' -import { toMarkdocTree } from '../lib/markdoc' +// import { toMarkdocTree } from '../lib/markdoc' import Markdoc from '@markdoc/markdoc' export const prerender = false @@ -36,7 +36,8 @@ export const GET = (async (context) => { blogs.map(async (blog) => { const blogContent = (await getBlog(blog.id))?.content || '博客内容暂不可用' - const blogTree = await toMarkdocTree(blogContent) + // const blogTree = await toMarkdocTree(blogContent) + const blogTree = Markdoc.transform(Markdoc.parse(blogContent)) const html = Markdoc.renderers.html(blogTree) const rssItem: RSSFeedItem = { @@ -45,6 +46,14 @@ export const GET = (async (context) => { link: `${site}/blogs/${blog.id}`, pubDate: new Date(blog.created_at), content: html, + author: blog.author.nickname, + enclosure: blog.featured_image + ? { + url: blog.featured_image.image_url, + length: 0, + type: 'image/jpeg', + } + : undefined, } return rssItem