This commit is contained in:
@ -6,7 +6,7 @@ import {
|
|||||||
type ListBlogItemType,
|
type ListBlogItemType,
|
||||||
} from '../lib/apis/legacy/blog'
|
} from '../lib/apis/legacy/blog'
|
||||||
import { ensureShikiEngine } from '../lib/markdown'
|
import { ensureShikiEngine } from '../lib/markdown'
|
||||||
import { toMarkdocTree } from '../lib/markdoc'
|
// import { toMarkdocTree } from '../lib/markdoc'
|
||||||
import Markdoc from '@markdoc/markdoc'
|
import Markdoc from '@markdoc/markdoc'
|
||||||
|
|
||||||
export const prerender = false
|
export const prerender = false
|
||||||
@ -36,7 +36,8 @@ export const GET = (async (context) => {
|
|||||||
blogs.map(async (blog) => {
|
blogs.map(async (blog) => {
|
||||||
const blogContent =
|
const blogContent =
|
||||||
(await getBlog(blog.id))?.content || '博客内容暂不可用'
|
(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 html = Markdoc.renderers.html(blogTree)
|
||||||
|
|
||||||
const rssItem: RSSFeedItem = {
|
const rssItem: RSSFeedItem = {
|
||||||
@ -45,6 +46,14 @@ export const GET = (async (context) => {
|
|||||||
link: `${site}/blogs/${blog.id}`,
|
link: `${site}/blogs/${blog.id}`,
|
||||||
pubDate: new Date(blog.created_at),
|
pubDate: new Date(blog.created_at),
|
||||||
content: html,
|
content: html,
|
||||||
|
author: blog.author.nickname,
|
||||||
|
enclosure: blog.featured_image
|
||||||
|
? {
|
||||||
|
url: blog.featured_image.image_url,
|
||||||
|
length: 0,
|
||||||
|
type: 'image/jpeg',
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
return rssItem
|
return rssItem
|
||||||
|
|||||||
Reference in New Issue
Block a user