mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
site: Add redirect page
This commit is contained in:
parent
9bf76ff76a
commit
e1e58255cc
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 6
|
||||
title: Advanced Search
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 6
|
||||
title: 高级搜索
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview-cn';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 5
|
||||
title: Complex Table
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 5
|
||||
title: 表格:复杂数据
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview-cn';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 2
|
||||
title: Form
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 2
|
||||
title: 表单
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview-cn';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 3
|
||||
title: List
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 3
|
||||
title: 列表
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview-cn';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 1
|
||||
title: Navigation
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/navigation';
|
||||
`````
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
order: 1
|
||||
title: 导航
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/navigation-cn';
|
||||
`````
|
@ -1,10 +0,0 @@
|
||||
---
|
||||
order: 4
|
||||
title:
|
||||
zh-CN: 表格
|
||||
en-US: Table
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/overview';
|
||||
`````
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Download
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/download';
|
||||
`````
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: 资源下载
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/download-cn';
|
||||
`````
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Reference
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/reference';
|
||||
`````
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: 文献素材
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/reference-cn';
|
||||
`````
|
@ -3,5 +3,7 @@ title: Features
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/values';
|
||||
if (typeof window !== 'undefined') {
|
||||
window.location.href = '/docs/spec/values';
|
||||
}
|
||||
`````
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: 基本理念
|
||||
---
|
||||
|
||||
`````__react
|
||||
window.location.href = '/docs/spec/values-cn';
|
||||
`````
|
@ -3,6 +3,7 @@ const path = require('path');
|
||||
|
||||
const homeTmpl = './template/Home/index';
|
||||
const contentTmpl = './template/Content/index';
|
||||
const redirectTmpl = './template/Redirect';
|
||||
|
||||
function pickerGenerator(module) {
|
||||
const tester = new RegExp(`^docs/${module}`);
|
||||
@ -61,7 +62,7 @@ module.exports = {
|
||||
component: homeTmpl,
|
||||
}, {
|
||||
path: 'docs/pattern/:children',
|
||||
component: contentTmpl,
|
||||
component: redirectTmpl,
|
||||
}, {
|
||||
path: 'docs/react/:children',
|
||||
component: contentTmpl,
|
||||
@ -74,12 +75,18 @@ module.exports = {
|
||||
}, {
|
||||
path: 'components/:children/',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'docs/spec/feature',
|
||||
component: redirectTmpl,
|
||||
}, {
|
||||
path: 'docs/spec/feature-cn',
|
||||
component: redirectTmpl,
|
||||
}, {
|
||||
path: 'docs/spec/:children',
|
||||
component: contentTmpl,
|
||||
}, {
|
||||
path: 'docs/resource/:children',
|
||||
component: contentTmpl,
|
||||
component: redirectTmpl,
|
||||
}],
|
||||
},
|
||||
};
|
||||
|
39
site/theme/template/Redirect.jsx
Normal file
39
site/theme/template/Redirect.jsx
Normal file
@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
|
||||
|
||||
const redirect = {
|
||||
'/docs/resource/download': '/docs/spec/download',
|
||||
'/docs/resource/download-cn': '/docs/spec/download-cn',
|
||||
'/docs/resource/reference': '/docs/spec/reference',
|
||||
'/docs/resource/reference-cn': '/docs/spec/reference-cn',
|
||||
'/docs/spec/feature': '/docs/spec/values',
|
||||
'/docs/spec/feature-cn': '/docs/spec/values-cn',
|
||||
'/docs/pattern/advanced-search': '/docs/spec/overview',
|
||||
'/docs/pattern/advanced-search-cn': '/docs/spec/overview-cn',
|
||||
'/docs/pattern/complex-table': '/docs/spec/overview',
|
||||
'/docs/pattern/complex-table-cn': '/docs/spec/overview-cn',
|
||||
'/docs/pattern/from': '/docs/spec/overview',
|
||||
'/docs/pattern/from-cn': '/docs/spec/overview-cn',
|
||||
'/docs/pattern/list': '/docs/spec/overview',
|
||||
'/docs/pattern/list-cn': '/docs/spec/overview-cn',
|
||||
'/docs/pattern/navigation': '/docs/spec/navigation',
|
||||
'/docs/pattern/navigation-cn': '/docs/spec/navigation-cn',
|
||||
'/docs/pattern/table': '/docs/spec/overview',
|
||||
'/docs/pattern/table-cn': '/docs/spec/overview-cn',
|
||||
};
|
||||
|
||||
export default class Redirect extends React.Component {
|
||||
componentDidMount() {
|
||||
const { location } = this.props;
|
||||
const pathname = `/${location.pathname}`;
|
||||
Object.keys(redirect).forEach((from) => {
|
||||
if (pathname.indexOf(from) === 0) {
|
||||
window.location.href = redirect[from];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div />;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user