Skip to content

Commit

Permalink
site: unify link
Browse files Browse the repository at this point in the history
  • Loading branch information
benjycui committed Aug 3, 2016
1 parent 7ea4dfa commit dfc2672
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion site/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
path: 'changelog',
component: contentTmpl,
}, {
path: 'components/:children',
path: 'components/:children/',
component: contentTmpl,
}, {
path: 'docs/spec/:children',
Expand Down
2 changes: 1 addition & 1 deletion site/theme/template/Content/MainContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class MainContent extends React.Component {
const disabled = item.disabled;
const url = item.filename.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, '').toLowerCase();
const child = !item.link ?
<Link to={url} disabled={disabled}>
<Link to={/^components/.test(url) ? `${url}/` : url} disabled={disabled}>
{text}
</Link> :
<a href={item.link} target="_blank" disabled={disabled}>
Expand Down
4 changes: 3 additions & 1 deletion site/theme/template/Layout/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export default class Header extends React.Component {

render() {
const { location, components } = this.props;
const module = location.pathname.split('/').slice(0, -1).join('/');
const module = location.pathname.replace(/\/$/, '')
.split('/').slice(0, -1)
.join('/');
let activeMenuItem = module || 'home';
if (activeMenuItem === 'components' || location.pathname === 'changelog') {
activeMenuItem = 'docs/react';
Expand Down

0 comments on commit dfc2672

Please sign in to comment.