Merge pull request #1039 from timlrx/fix-static-feed
fix: static build should write to out folder
This commit is contained in:
commit
4d212bd4e6
@ -7,6 +7,8 @@ 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 outputFolder = process.env.EXPORT ? 'out' : 'public'
|
||||
|
||||
const generateRssItem = (config, post) => `
|
||||
<item>
|
||||
<guid>${config.siteUrl}/blog/${post.slug}</guid>
|
||||
@ -40,7 +42,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
|
||||
// RSS for blog post
|
||||
if (publishPosts.length > 0) {
|
||||
const rss = generateRss(config, sortPosts(publishPosts))
|
||||
writeFileSync(`./public/${page}`, rss)
|
||||
writeFileSync(`./${outputFolder}/${page}`, rss)
|
||||
}
|
||||
|
||||
if (publishPosts.length > 0) {
|
||||
@ -49,7 +51,7 @@ async function generateRSS(config, allBlogs, page = 'feed.xml') {
|
||||
post.tags.map((t) => slug(t)).includes(tag)
|
||||
)
|
||||
const rss = generateRss(config, filteredPosts, `tags/${tag}/${page}`)
|
||||
const rssPath = path.join('public', 'tags', tag)
|
||||
const rssPath = path.join(outputFolder, 'tags', tag)
|
||||
mkdirSync(rssPath, { recursive: true })
|
||||
writeFileSync(path.join(rssPath, page), rss)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user