From e521009670b50a618b8052c34aac8658ab89339c Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Tue, 20 Sep 2016 16:48:34 +0800 Subject: [PATCH] site: fix 404, close: #3098 --- site/theme/template/Content/index.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/site/theme/template/Content/index.jsx b/site/theme/template/Content/index.jsx index 907d61f001..8ecc361b81 100644 --- a/site/theme/template/Content/index.jsx +++ b/site/theme/template/Content/index.jsx @@ -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];