Skip to content

Commit 3939d58

Browse files
timlrxkuzdogan
authored andcommitted
fix: static build should write to out folder
1 parent 79614cb commit 3939d58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/rss.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import tagData from '../app/tag-data.json' assert { type: 'json' }
77
import { allBlogs } from '../.contentlayer/generated/index.mjs'
88
import { sortPosts } from 'pliny/utils/contentlayer.js'
99

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

4648
if (publishPosts.length > 0) {
@@ -49,7 +51,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
4951
post.tags.map((t) => slug(t)).includes(tag)
5052
)
5153
const rss = generateRss(config, filteredPosts, `tags/${tag}/${page}`)
52-
const rssPath = path.join('public', 'tags', tag)
54+
const rssPath = path.join(outputFolder, 'tags', tag)
5355
mkdirSync(rssPath, { recursive: true })
5456
writeFileSync(path.join(rssPath, page), rss)
5557
}

0 commit comments

Comments
 (0)