Files
NotionNext/pages/feed.js
tangly1024 005fb33a8f rss优化
2022-03-17 09:54:03 +08:00

17 lines
466 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?.allPosts?.slice(0, 10) || [])
res.write(xmlFeed)
res.end()
return {
props: {}
}
}
const feed = () => null
export default feed