site: fix routes

This commit is contained in:
Benjy Cui 2016-05-06 14:27:51 +08:00
parent 0283f61bba
commit c23d724ab9
3 changed files with 7 additions and 6 deletions

View File

@ -55,6 +55,11 @@ ReactDOM.render(
component={utils.getChildrenWrapper(reactComponents)} />
</Route>
{redirects}
<Route path="docs/react" component={ReactComponents}>
{utils.generateIndex(reactComponents)}
<Route path=":children"
component={utils.getChildrenWrapper(reactComponents)} />
</Route>
<Route path="docs/practice" component={Practice}>
{utils.generateIndex(practice)}
<Route path=":children"

View File

@ -60,7 +60,7 @@ export function generateIndex(data) {
const pathToFile = {};
Object.keys(redirects).forEach((key) => pathToFile[redirects[key]] = key);
pathToFile['components/changelog'] = './CHANGELOG'; // TODO
pathToFile['docs/react/changelog'] = './CHANGELOG'; // TODO
export function getChildrenWrapper(data) {
return function childrenWrapper(props) {
const trimedPathname = props.location.pathname.replace(/^\//, '');

View File

@ -15,11 +15,7 @@ export default {
},
redirects: {
'docs/react/introduce': 'components/introduce',
'docs/react/getting-started': 'components/getting-started',
'docs/react/install': 'components/install',
'docs/react/upgrade-notes': 'components/upgrade-notes',
CHANGELOG: 'components/changelog',
CHANGELOG: 'docs/react/changelog',
},
docVersions: {