site: fix

This commit is contained in:
Benjy Cui 2016-06-03 15:51:44 +08:00
parent 5be40a9c7f
commit 5ed813bdca
3 changed files with 8 additions and 6 deletions

View File

@ -25,7 +25,7 @@ module.exports = {
'/docs/practice/:children': contentTmpl, '/docs/practice/:children': contentTmpl,
'/docs/pattern/:children': contentTmpl, '/docs/pattern/:children': contentTmpl,
'/docs/react/:children': contentTmpl, '/docs/react/:children': contentTmpl,
'/CHANGELOG': contentTmpl, '/changelog': contentTmpl,
'/components/:children': contentTmpl, '/components/:children': contentTmpl,
'/docs/spec/:children': contentTmpl, '/docs/spec/:children': contentTmpl,
'/docs/resource/:children': contentTmpl, '/docs/resource/:children': contentTmpl,

View File

@ -62,7 +62,7 @@ export default class Article extends React.Component {
) )
} }
{ {
!content.toc ? null : !(content.toc && meta.toc) ? null :
<section className="toc">{props.utils.toReactComponent(content.toc)}</section> <section className="toc">{props.utils.toReactComponent(content.toc)}</section>
} }
{ {

View File

@ -40,7 +40,7 @@ export default class MainContent extends React.Component {
<span className="chinese" key="chinese">{item.subtitle || item.chinese}</span>, <span className="chinese" key="chinese">{item.subtitle || item.chinese}</span>,
]; ];
const disabled = item.disabled; const disabled = item.disabled;
const url = item.filename.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, ''); const url = item.filename.replace(/(\/index)?((\.zh-CN)|(\.en-US))?\.md$/i, '').toLowerCase();
const child = !item.link ? const child = !item.link ?
<Link to={url} disabled={disabled}> <Link to={url} disabled={disabled}>
{text} {text}
@ -85,11 +85,11 @@ export default class MainContent extends React.Component {
const props = this.props; const props = this.props;
let moduleData; let moduleData;
if (/(docs\/react\/)|(components\/)|(CHANGELOG)/i.test(props.location.pathname)) { if (/(docs\/react\/)|(components\/)|(changelog)/i.test(props.location.pathname)) {
moduleData = { moduleData = {
...props.data.docs.react, ...props.data.docs.react,
...props.data.components, ...props.data.components,
CHANGELOG: props.data.CHANGELOG, changelog: props.data.CHANGELOG,
}; };
} else { } else {
moduleData = props.utils.get(props.data, props.location.pathname.split('/').slice(0, 2)); moduleData = props.utils.get(props.data, props.location.pathname.split('/').slice(0, 2));
@ -153,7 +153,9 @@ export default class MainContent extends React.Component {
const locale = this.context.intl.locale; const locale = this.context.intl.locale;
const moduleData = this.getModuleData(); const moduleData = this.getModuleData();
const pageData = props.pageData.index || props.pageData; const pageData = /changelog/i.test(props.location.pathname) ?
props.data.CHANGELOG :
(props.pageData.index || props.pageData);
const localizedPageData = pageData[locale] || pageData; const localizedPageData = pageData[locale] || pageData;
return ( return (
<div className="main-wrapper"> <div className="main-wrapper">