Skip to content

Commit d2d44bd

Browse files
kuzdogantimlrx
andauthored
Output the RSS feed (#32)
* fix: static build should write to out folder * Fix generateRSS --------- Co-authored-by: Timothy Lin <[email protected]>
1 parent 187bc51 commit d2d44bd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/rss.mjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import siteMetadata from '../data/siteMetadata.js'
66
import { allBlogs } from '../.contentlayer/generated/index.mjs'
77
import { sortPosts } from 'pliny/utils/contentlayer.js'
88

9+
const outputFolder = process.env.EXPORT ? 'out' : 'public'
10+
911
const generateRssItem = (config, post) => `
1012
<item>
1113
<guid>${config.siteUrl}/blog/${post.slug}</guid>
@@ -39,7 +41,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
3941
// RSS for blog post
4042
if (publishPosts.length > 0) {
4143
const rss = generateRss(config, sortPosts(publishPosts))
42-
writeFileSync(`./public/${page}`, rss)
44+
writeFileSync(`./${outputFolder}/${page}`, rss)
4345
}
4446
}
4547

0 commit comments

Comments
 (0)