From 475769fcf6c6dfb534ec110a1aca54e6efa7b4dc Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Mon, 21 Feb 2022 12:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=92=E6=A1=A3=E6=96=87=E7=AB=A0=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 61a5a934..22303348 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -28,7 +28,11 @@ export async function getGlobalNotionData ({ const notionPageData = await getNotionPageData({ pageId, from }) const tagOptions = notionPageData.tagOptions const allPosts = await getAllPosts({ notionPageData, from, includePage }) - const postCount = allPosts?.length + const postCount = allPosts?.filter(post => + post.title && post.slug && + post?.status?.[0] === 'Published' && + (post?.type?.[0] === 'Post') + )?.length const categories = await getAllCategories(allPosts) const tags = await getAllTags({ allPosts, tagOptions, sliceCount: tagsCount }) // 深拷贝