Skip to content

Commit 631777c

Browse files
authored
Unbreak more links (#234)
1 parent 53c34ee commit 631777c

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

docs/about.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ hide_title: true
1818
/>
1919
</h2>
2020
<p>
21-
<a href="./studio">Stately Studio</a> is a suite of tools for visualizing
22-
and collaborating on your application logic, powered by XState.
21+
<a href="./docs/studio">Stately Studio</a> is a suite of tools for
22+
visualizing and collaborating on your application logic, powered by
23+
XState.
2324
</p>
2425
</div>
2526
<div class="docs-intro-xstate">
@@ -33,8 +34,8 @@ hide_title: true
3334
/>
3435
</h2>
3536
<p>
36-
<a href="./xstate">XState</a> is a best-in-class open source library for
37-
orchestrating and managing state in JavaScript and TypeScript apps.
37+
<a href="./docs/xstate">XState</a> is a best-in-class open source library
38+
for orchestrating and managing state in JavaScript and TypeScript apps.
3839
</p>
3940
</div>
4041
</div>

docusaurus.config.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ const config = {
105105
],
106106
],
107107

108+
plugins: [
109+
[
110+
'@docusaurus/plugin-client-redirects',
111+
{
112+
// Unbreak specific pages we know are broken where the structure changed between XState v4 and v5
113+
redirects: [
114+
{
115+
to: '/docs/xstate-v4/xstate/model-based-testing/intro',
116+
from: '/docs/category/xstate-model-based-testing',
117+
},
118+
{
119+
to: '/docs/xstate-v4/xstate/actors/parent-child-communication',
120+
from: '/docs/xstate/actors/parent-child-communication',
121+
},
122+
{
123+
to: '/docs/xstate-v4/xstate/typescript/type-helpers',
124+
from: '/docs/xstate/typescript/type-helpers',
125+
},
126+
],
127+
createRedirects(existingPath) {
128+
if (existingPath.includes('/docs')) {
129+
// Redirect everything from /docs/xstate-v5 to /docs (to unbreak Google search results)
130+
return [existingPath.replace('/docs', '/docs/xstate-v5')];
131+
}
132+
return undefined; // Return a falsy value: no redirect created
133+
},
134+
},
135+
],
136+
],
137+
108138
themeConfig:
109139
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
110140
({

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
"dependencies": {
3030
"@docusaurus/core": "^2.4.3",
31+
"@docusaurus/plugin-client-redirects": "^2.4.3",
3132
"@docusaurus/preset-classic": "^2.4.3",
3233
"@docusaurus/remark-plugin-npm2yarn": "^2.4.3",
3334
"@mdx-js/react": "^1.6.22",

yarn.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,21 @@
14841484
react-helmet-async "*"
14851485
react-loadable "npm:@docusaurus/[email protected]"
14861486

1487+
"@docusaurus/plugin-client-redirects@^2.4.3":
1488+
version "2.4.3"
1489+
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-client-redirects/-/plugin-client-redirects-2.4.3.tgz#0da7e6facadbca3bd7cb8d0453f21bea7f4f1721"
1490+
integrity sha512-iCwc/zH8X6eNtLYdyUJFY6+GbsbRgMgvAC/TmSmCYTmwnoN5Y1Bc5OwUkdtoch0XKizotJMRAmGIAhP8sAetdQ==
1491+
dependencies:
1492+
"@docusaurus/core" "2.4.3"
1493+
"@docusaurus/logger" "2.4.3"
1494+
"@docusaurus/utils" "2.4.3"
1495+
"@docusaurus/utils-common" "2.4.3"
1496+
"@docusaurus/utils-validation" "2.4.3"
1497+
eta "^2.0.0"
1498+
fs-extra "^10.1.0"
1499+
lodash "^4.17.21"
1500+
tslib "^2.4.0"
1501+
14871502
"@docusaurus/[email protected]":
14881503
version "2.4.3"
14891504
resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.4.3.tgz#6473b974acab98e967414d8bbb0d37e0cedcea14"

0 commit comments

Comments
 (0)