Skip to content

Commit

Permalink
Return the old path when next is missing from the url (#13078)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordojordo authored Jan 13, 2025
1 parent fdc25a9 commit 1621fe5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ const config = {
'@docusaurus/plugin-client-redirects',
{
createRedirects(existingPath) {
if (existingPath.includes('/extensions') && !existingPath.includes('/next') && !existingPath.includes('/v2')) {
return [
existingPath.replace('/extensions', '/extensions/next')
];
// This function is invoked once per existing doc page, and we
// must return the “old” routes that we want to map to that doc’s path
if (existingPath.startsWith('/extensions/next')) {
// Generate the "old" route we want to redirect from
const oldPath = existingPath.replace('/extensions/next', '/extensions');

return [oldPath];
}

return undefined; // Return a falsy value: no redirect created
Expand Down

0 comments on commit 1621fe5

Please sign in to comment.