site: fix 404, close: #3098

This commit is contained in:
Benjy Cui 2016-09-20 16:48:34 +08:00
parent 602000f1a1
commit e521009670

View File

@ -11,6 +11,11 @@ const locale = isZhCN ? 'zh-CN' : 'en-US';
export function collect(nextProps, callback) {
const pageData = nextProps.location.pathname === 'changelog' ?
nextProps.data.CHANGELOG : nextProps.pageData;
if (!pageData) {
callback(404, nextProps);
return;
}
const pageDataPromise = typeof pageData === 'function' ?
pageData() : (pageData[locale] || pageData.index[locale] || pageData.index)();
const promises = [pageDataPromise];