Skip to content

Commit

Permalink
fix: use feed.xml instead of index.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
timlrx committed Jul 11, 2021
1 parent af91700 commit e66018b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
13 changes: 0 additions & 13 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,4 @@ module.exports = withBundleAnalyzer({

return config
},
async rewrites() {
return {
beforeFiles: [
// Rewrite to prevent a problem when deploying at vercel
// which directs a user to the index.xml instead of index.html
// https://github.com/timlrx/tailwind-nextjs-starter-blog/issues/16
{
source: '/',
destination: '/index',
},
],
}
},
})
2 changes: 1 addition & 1 deletion pages/blog/[...slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function getStaticProps({ params }) {

// rss
const rss = generateRss(allPosts)
fs.writeFileSync('./public/index.xml', rss)
fs.writeFileSync('./public/feed.xml', rss)

return { props: { post, authorDetails, prev, next } }
}
Expand Down
4 changes: 2 additions & 2 deletions pages/tags/[tag].js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export async function getStaticProps({ params }) {
)

// rss
const rss = generateRss(filteredPosts, `tags/${params.tag}/index.xml`)
const rss = generateRss(filteredPosts, `tags/${params.tag}/feed.xml`)
const rssPath = path.join(root, 'public', 'tags', params.tag)
fs.mkdirSync(rssPath, { recursive: true })
fs.writeFileSync(path.join(rssPath, 'index.xml'), rss)
fs.writeFileSync(path.join(rssPath, 'feed.xml'), rss)

return { props: { posts: filteredPosts, tag: params.tag } }
}
Expand Down

0 comments on commit e66018b

Please sign in to comment.