From 9321b2dfaed30d631784472c91d05ae2eaa3d273 Mon Sep 17 00:00:00 2001 From: anime Date: Wed, 9 Jul 2025 14:39:47 +0800 Subject: [PATCH] feat(getPageContentText): update getPageContentText to use post.content array - modify content extraction logic to use post.content array - avoid extra but wrong result by checking pageBlockMap.block --- lib/notion/getPageContentText.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/notion/getPageContentText.js b/lib/notion/getPageContentText.js index 18672cc0..94f791a5 100644 --- a/lib/notion/getPageContentText.js +++ b/lib/notion/getPageContentText.js @@ -84,12 +84,12 @@ export function getPageContentText(post, pageBlockMap) { } const postId = post.id + const postContent = post.content let contentTextList = [] // 防止搜到加密文章的内容 - if (pageBlockMap && pageBlockMap.block && !post.password) { - const contentIds = Object.keys(pageBlockMap.block) - for (const id of contentIds) { - const blockContentText = getBlockContentText(id) + if (postContent.length > 0 && !post.password) { + for (const postContentId of postContent) { + const blockContentText = getBlockContentText(postContentId) if (blockContentText) { contentTextList.push(blockContentText) }