Skip to content

Commit

Permalink
feat(next): add legacy rss rewrite rules
Browse files Browse the repository at this point in the history
  • Loading branch information
chengpeiquan committed Jan 25, 2025
1 parent ce7d691 commit d7e8924
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,24 @@ const nextConfig = {
return config
},
async redirects() {
const neteaseDocSources = ['/topic/netease/:slug*', '/article/my-netease']
const config = {
netease: {
sources: ['/topic/netease/:slug*', '/article/my-netease'],
destination: '/article/my-five-years-working-at-netease',
},
rss: {
sources: ['/feed', '/feed/', '/feed.atom', '/feed.json'],
destination: '/feed.xml',
},
}

return [
...neteaseDocSources.map((source) => {
return {
source,
destination: '/article/my-five-years-working-at-netease',
permanent: true,
}
}),
]
return Object.values(config).flatMap(({ sources, destination }) =>
sources.map((source) => ({
source,
destination,
permanent: true,
})),
)
},
}

Expand Down

0 comments on commit d7e8924

Please sign in to comment.