Skip to content

Commit 6d93765

Browse files
committed
Add client redirects for the seven doc URLs the upgrade moves
Docusaurus treats a doc whose filename matches its folder as that category's index page, a convention introduced after 2.0.0-beta.5. Upgrading therefore shortens seven API doc URLs, e.g. /docs/mapillary.config/mapillary.config -> /docs/mapillary.config Nothing in the repo references the old paths and every internal link regenerates, but external bookmarks and inbound links would 404. This adds @docusaurus/plugin-client-redirects and maps each old path to its new one. Verified by building and following each redirect: all seven stubs are emitted with the correct target, and the content reached through them matches what the old URL served. The only differences are chrome the v3 theme renders differently (prev/next arrows, dark-mode toggle icons). Build output goes 43 -> 50 pages: 43 real pages plus 7 redirect stubs. Internal link check still reports 0 unresolvable across 49 links. docs/tags is intentionally not redirected. It existed in v2 as an empty tag index with no tags to list; v3 omits it rather than emitting an empty page.
1 parent eef339f commit 6d93765

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

‎docs/docusaurus.config.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,29 @@ module.exports = {
150150
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc. Built with Docusaurus.`,
151151
},
152152
},
153+
plugins: [
154+
[
155+
'@docusaurus/plugin-client-redirects',
156+
{
157+
// Docusaurus treats a doc whose filename matches its folder as that
158+
// category's index page, a convention introduced after 2.0.0-beta.5.
159+
// Upgrading therefore shortened these seven URLs. Redirect the old
160+
// paths so external links and bookmarks keep working.
161+
redirects: [
162+
'mapillary',
163+
'mapillary.config',
164+
'mapillary.config.api',
165+
'mapillary.controller',
166+
'mapillary.models',
167+
'mapillary.models.api',
168+
'mapillary.utils',
169+
].map((name) => ({
170+
from: `/docs/${name}/${name}`,
171+
to: `/docs/${name}`,
172+
})),
173+
},
174+
],
175+
],
153176
presets: [
154177
[
155178
'@docusaurus/preset-classic',

‎docs/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
},
2020
"dependencies": {
2121
"@docusaurus/core": "^3.10.2",
22+
"@docusaurus/plugin-client-redirects": "^3.10.2",
2223
"@docusaurus/preset-classic": "^3.10.2",
2324
"@mdx-js/react": "^3.0.0",
2425
"clsx": "^2.1.1",

‎docs/yarn.lock‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,21 @@
16941694
react-helmet-async "npm:@slorber/react-helmet-async@1.3.0"
16951695
react-loadable "npm:@docusaurus/react-loadable@6.0.0"
16961696

1697+
"@docusaurus/plugin-client-redirects@^3.10.2":
1698+
version "3.10.2"
1699+
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-3.10.2.tgz#55023f8538baf7e66ec33c49ab65879c74fd93cd"
1700+
integrity sha512-z5I5ttCXw+8y2gHVZvqAMmUw4Rb0ZzKA5eCPk87SfM/jCKOTvE24yDpPAwwipvug96ij7mOwEHXWw8G4LlWdGA==
1701+
dependencies:
1702+
"@docusaurus/core" "3.10.2"
1703+
"@docusaurus/logger" "3.10.2"
1704+
"@docusaurus/utils" "3.10.2"
1705+
"@docusaurus/utils-common" "3.10.2"
1706+
"@docusaurus/utils-validation" "3.10.2"
1707+
eta "^2.2.0"
1708+
fs-extra "^11.1.1"
1709+
lodash "^4.17.21"
1710+
tslib "^2.6.0"
1711+
16971712
"@docusaurus/plugin-content-blog@3.10.2":
16981713
version "3.10.2"
16991714
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-3.10.2.tgz#2374886ec3d76e8f014e85db8c3c010de6c419be"

0 commit comments

Comments
 (0)