@@ -7,6 +7,8 @@ import tagData from '../app/tag-data.json' assert { type: 'json' }
7
7
import { allBlogs } from '../.contentlayer/generated/index.mjs'
8
8
import { sortPosts } from 'pliny/utils/contentlayer.js'
9
9
10
+ const outputFolder = process . env . EXPORT ? 'out' : 'public'
11
+
10
12
const generateRssItem = ( config , post ) => `
11
13
<item>
12
14
<guid>${ config . siteUrl } /blog/${ post . slug } </guid>
@@ -40,7 +42,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
40
42
// RSS for blog post
41
43
if ( publishPosts . length > 0 ) {
42
44
const rss = generateRss ( config , sortPosts ( publishPosts ) )
43
- writeFileSync ( `./public /${ page } ` , rss )
45
+ writeFileSync ( `./${ outputFolder } /${ page } ` , rss )
44
46
}
45
47
46
48
if ( publishPosts . length > 0 ) {
@@ -49,7 +51,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
49
51
post . tags . map ( ( t ) => slug ( t ) ) . includes ( tag )
50
52
)
51
53
const rss = generateRss ( config , filteredPosts , `tags/${ tag } /${ page } ` )
52
- const rssPath = path . join ( 'public' , 'tags' , tag )
54
+ const rssPath = path . join ( outputFolder , 'tags' , tag )
53
55
mkdirSync ( rssPath , { recursive : true } )
54
56
writeFileSync ( path . join ( rssPath , page ) , rss )
55
57
}
0 commit comments