Files
NotionNext/pages/feed.js
2022-01-17 21:53:52 +08:00

17 lines
425 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 { allPosts } = getGlobalNotionData({ from: 'rss' })
const xmlFeed = generateRss(allPosts.slice(0, 10))
res.write(xmlFeed)
res.end()
return {
props: {}
}
}
const feed = () => null
export default feed