Files
NotionNext/pages/feed/index.js
2022-11-12 22:05:49 +08:00

18 lines
479 B
JavaScript

import { generateRss } from '@/lib/rss'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
export async function getServerSideProps ({ res }) {
res.setHeader('Content-Type', 'text/xml')
// 获取最新文章
const globalNotionData = await getGlobalNotionData({ from: 'rss' })
const xmlFeed = await generateRss(globalNotionData?.latestPosts || [])
res.write(xmlFeed)
res.end()
return {
props: {}
}
}
const feed = () => null
export default feed