feat: make the new names backward-compatible

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-11-24 16:08:32 +01:00
parent e1dea0cdbc
commit b78fdd98b8
Signed by: mfocko
GPG key ID: 7C47D46246790496
3 changed files with 41 additions and 0 deletions

View file

@ -58,6 +58,15 @@ const subjects = [
new Docs("cpp", "C++"),
];
const fallbackMapping = [
{ new: "algorithms", old: ["ib002"] },
{ new: "functional", old: ["ib015"] },
{ new: "automata", old: ["ib110"] },
{ new: "foundations", old: ["ib111"] },
{ new: "c", old: ["pb071"] },
{ new: "cpp", old: ["pb161"] },
];
/** @type {import('@docusaurus/types').Config} */
const config = {
title: "mf",
@ -115,6 +124,22 @@ const config = {
},
],
"docusaurus-plugin-sass",
[
"@docusaurus/plugin-client-redirects",
{
createRedirects(existingPath) {
for (let mapping of fallbackMapping) {
if (existingPath.includes(`/${mapping.new}/`)) {
return mapping.old.map((old) =>
existingPath.replace(`/${mapping.new}/`, `/${old}/`)
);
}
}
return undefined; // no redirect created
},
},
],
],
stylesheets: [

View file

@ -15,6 +15,7 @@
},
"dependencies": {
"@docusaurus/core": "^3.0.0",
"@docusaurus/plugin-client-redirects": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@docusaurus/theme-mermaid": "^3.0.0",
"@mdx-js/react": "^3.0.0",

View file

@ -1355,6 +1355,21 @@
react-helmet-async "*"
react-loadable "npm:@docusaurus/react-loadable@5.5.2"
"@docusaurus/plugin-client-redirects@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-3.0.0.tgz#983880c467228ed8b1aba5f20ce564696e25f363"
integrity sha512-JcZLod4lgPdbv/OpCbNwTc57u54d01dcWiDy/sBaxls/4HkDGdj6838oBPzbBdnCWrmasBIRz3JYLk+1GU0IOQ==
dependencies:
"@docusaurus/core" "3.0.0"
"@docusaurus/logger" "3.0.0"
"@docusaurus/utils" "3.0.0"
"@docusaurus/utils-common" "3.0.0"
"@docusaurus/utils-validation" "3.0.0"
eta "^2.2.0"
fs-extra "^11.1.1"
lodash "^4.17.21"
tslib "^2.6.0"
"@docusaurus/plugin-content-blog@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.0.0.tgz#5f3ede003b2b7103043918fbe3f436c116839ca8"