Skip to content

Commit

Permalink
Output the RSS feed (#32)
Browse files Browse the repository at this point in the history
* fix: static build should write to out folder

* Fix generateRSS

---------

Co-authored-by: Timothy Lin <timothy0336@hotmail.com>
  • Loading branch information
kuzdogan and timlrx authored Nov 8, 2024
1 parent 187bc51 commit d2d44bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/rss.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import siteMetadata from '../data/siteMetadata.js'
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>
Expand Down Expand Up @@ -39,7 +41,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)
}
}

Expand Down

0 comments on commit d2d44bd

Please sign in to comment.