mirror of https://github.com/yewstack/yew
Setup doc redirects for old routes (#1501)
This commit is contained in:
parent
0220506b74
commit
e6406190c7
|
@ -1,11 +1,41 @@
|
||||||
{
|
{
|
||||||
"hosting": {
|
"hosting": {
|
||||||
|
"site": "yew-rs",
|
||||||
"public": "website/build/yew",
|
"public": "website/build/yew",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"firebase.json",
|
"firebase.json",
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"**/node_modules/**"
|
"**/node_modules/**"
|
||||||
],
|
],
|
||||||
|
"redirects": [ {
|
||||||
|
"source": "/",
|
||||||
|
"destination": "/docs/en/intro/",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"source": "/docs",
|
||||||
|
"destination": "/docs/en/intro/",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"regex": "/(docs/)?(?P<lang>en|ja|zh-TW|zh-CN)",
|
||||||
|
"destination": "/docs/:lang/intro/",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"source": "/docs/v/zh_cn",
|
||||||
|
"destination": "/docs/zh-CN/intro/",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"source": "/docs/v/zh_tw",
|
||||||
|
"destination": "/docs/zh-TW/intro/",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"regex": "/docs/v/zh_cn/(.*)",
|
||||||
|
"destination": "/docs/zh-CN/:1",
|
||||||
|
"type": 301
|
||||||
|
}, {
|
||||||
|
"regex": "/docs/v/zh_tw/(.*)",
|
||||||
|
"destination": "/docs/zh-TW/:1",
|
||||||
|
"type": 301
|
||||||
|
} ],
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
{
|
||||||
"source": "**",
|
"source": "**",
|
||||||
|
|
|
@ -7,29 +7,7 @@
|
||||||
content="0; url=/docs/en/intro"
|
content="0; url=/docs/en/intro"
|
||||||
/>
|
/>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// Redirect old translated paths
|
window.location.href = '/docs/en/intro';
|
||||||
if (window.location.pathname.includes('/v/')) {
|
|
||||||
var pathname = window.location.pathname.replace('/v/zh_cn', '/zh-CN').replace('/v/zh_tw', '/zh-TW');
|
|
||||||
if (pathname === window.location.pathname) {
|
|
||||||
window.location.href = '/docs/en/intro';
|
|
||||||
} else {
|
|
||||||
if (pathname.endsWith('/')) {
|
|
||||||
pathname = pathname.substring(0, pathname.length - 1);
|
|
||||||
}
|
|
||||||
if (pathname.endsWith('zh-CN') || pathname.endsWith('zh-TW')) {
|
|
||||||
pathname += '/intro';
|
|
||||||
}
|
|
||||||
window.location.href = pathname;
|
|
||||||
}
|
|
||||||
// Redirect broken links
|
|
||||||
} else if (window.location.pathname.includes('/zh-TW')) {
|
|
||||||
window.location.href = '/docs/zh-TW/intro';
|
|
||||||
// Redirect broken links
|
|
||||||
} else if (window.location.pathname.includes('/zh-CN')) {
|
|
||||||
window.location.href = '/docs/zh-CN/intro';
|
|
||||||
} else {
|
|
||||||
window.location.href = '/docs/en/intro';
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<title>Yew Docs</title>
|
<title>Yew Docs</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in New Issue