diff --git a/site/theme/index.js b/site/theme/index.js index 74315314b7..503ddc231e 100644 --- a/site/theme/index.js +++ b/site/theme/index.js @@ -25,7 +25,7 @@ module.exports = { '/docs/practice/:children': contentTmpl, '/docs/pattern/:children': contentTmpl, '/docs/react/:children': contentTmpl, - '/CHANGELOG': contentTmpl, + '/changelog': contentTmpl, '/components/:children': contentTmpl, '/docs/spec/:children': contentTmpl, '/docs/resource/:children': contentTmpl, diff --git a/site/theme/template/Content/Article.jsx b/site/theme/template/Content/Article.jsx index bf3056a1ab..1ff8048267 100644 --- a/site/theme/template/Content/Article.jsx +++ b/site/theme/template/Content/Article.jsx @@ -62,7 +62,7 @@ export default class Article extends React.Component { ) } { - !content.toc ? null : + !(content.toc && meta.toc) ? null :
{props.utils.toReactComponent(content.toc)}
} { diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index e0c612aee1..08e3c75ddb 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -40,7 +40,7 @@ export default class MainContent extends React.Component { {item.subtitle || item.chinese}, ]; 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 ? {text} @@ -85,11 +85,11 @@ export default class MainContent extends React.Component { const props = this.props; let moduleData; - if (/(docs\/react\/)|(components\/)|(CHANGELOG)/i.test(props.location.pathname)) { + if (/(docs\/react\/)|(components\/)|(changelog)/i.test(props.location.pathname)) { moduleData = { ...props.data.docs.react, ...props.data.components, - CHANGELOG: props.data.CHANGELOG, + changelog: props.data.CHANGELOG, }; } else { 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 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; return (