fix: use sort posts for rss, fix lastBuildDate

This commit is contained in:
ttyS3 2023-10-12 01:01:29 +08:00
parent 102e1fee7f
commit d754ca9dfd
No known key found for this signature in database
GPG Key ID: A83C6C687C9E7888

View File

@ -5,6 +5,7 @@ import { escape } from 'pliny/utils/htmlEscaper.js'
import siteMetadata from '../data/siteMetadata.js'
import tagData from '../app/tag-data.json' assert { type: 'json' }
import { allBlogs } from '../.contentlayer/generated/index.mjs'
import { sortPosts } from 'pliny/utils/contentlayer.js'
const generateRssItem = (config, post) => `
<item>
@ -38,7 +39,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
const publishPosts = allBlogs.filter((post) => post.draft !== true)
// RSS for blog post
if (publishPosts.length > 0) {
const rss = generateRss(config, publishPosts)
const rss = generateRss(config, sortPosts(publishPosts))
writeFileSync(`./public/${page}`, rss)
}