rss优化

This commit is contained in:
tangly1024
2022-03-17 09:54:03 +08:00
parent 72f45e5866
commit 005fb33a8f
2 changed files with 30 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ 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 = generateRss(globalNotionData?.allPosts?.slice(0, 10) || [])
const xmlFeed = await generateRss(globalNotionData?.allPosts?.slice(0, 10) || [])
res.write(xmlFeed)
res.end()
return {