From 63fd4a265c02c7f7fef84fc6a31654bb3ba6a21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=80=80=E7=AD=96?= Date: Fri, 1 Apr 2022 22:39:01 +0800 Subject: [PATCH] fix: fix build error for no title or description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 对于未设置标题或者描述的 notion 文档会出现报错,本 pr 修复了此问题。 --- lib/notion/getNotionData.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index ea10fa0b..1c0c845b 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -157,8 +157,8 @@ async function getBlogInfo ({ notionPageData, from }) { return null } const collection = notionPageData?.collection - const title = collection?.name[0][0] || BLOG.TITLE - const description = collection?.description[0][0] || BLOG.DESCRIPTION + const title = collection?.name?.[0][0] || BLOG.TITLE + const description = collection?.description?.[0][0] || BLOG.DESCRIPTION const pageCover = mapCoverUrl(collection?.cover, notionPageData.block) return { title, description, pageCover } }