[fix-for-redirects] - fixed redirects to fit docusaurus pattern according to their docs.

This commit is contained in:
GuiLeme 2023-04-13 11:56:59 -03:00
parent a7c709a562
commit 080292d3d6

View File

@ -81,21 +81,31 @@ const config = {
from: "/greenlight_v3/gl3-migration.html" from: "/greenlight_v3/gl3-migration.html"
} }
], ],
// We interpret the path argument as the path "to"
// and the return of this function as the paths "from"
createRedirects: (path) => { createRedirects: (path) => {
// TODO: remove default route to / // TODO: remove default route to /
if ( path.startsWith("/2.6") ) { const redirect_list = [];
// remove the /2.6 from the path, for example:
// /2.6/redirect -> /redirect // Create redirect paths for all routes except 2.5 ones
return [ path.replace("/2.6","") ]; if ( !path.startsWith("/2.5") ){
redirect_list.push("/2.6" + path);
} }
if ( path.startsWith("/admin/") ) {
// handle the old docs group /admin if ( path.includes("/testing/release-testing") ){
return [ path.replace("/admin/","/administration/") ]; redirect_list.push( path.replace("/testing/release-testing", "/release-tests.html") )
} }
if ( path.startsWith("/dev/") ) { // Handle the old docs group /admin
// handle the old docs group /dev if ( path.startsWith("/administration") ) {
return [ path.replace("/dev/","/development/") ]; // creates new routes /admin/something pointing to /administration
redirect_list.push( path.replace("/administration", "/admin") );
} }
// handle the old docs group /dev
if ( path.startsWith("/development") ) {
// creates new routes /dev/something pointing to /development
redirect_list.push( path.replace("/development", "/dev") );
}
return redirect_list;
}, },
} }
], ],