From 18916e448f1b6f0f6ff6e5c85094ecc6d11907ff Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 29 Oct 2023 22:45:37 +0800 Subject: [PATCH] =?UTF-8?q?CONFIG-TABLE=20=E6=8F=90=E4=BA=A4=E9=A6=96?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index f885f22b..6c01c294 100755 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -272,6 +272,7 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) { // 文章计数 let postCount = 0 + // 查找所有的Post和Page const allPages = collectionData.filter(post => { if (post?.type === 'Post' && post.status === 'Published') { @@ -282,6 +283,16 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) { (post?.status === 'Invisible' || post?.status === 'Published') }) + // 从notion中读取配置 + const configPage = collectionData.find(post => { + return post && post?.type && post?.type === 'CONFIG' + }) + + if (configPage) { + const config = await getPostBlocks(configPage.id, 'config-table') + console.log('配置中心', configPage, config) + } + // Sort by date if (BLOG.POSTS_SORT_BY === 'date') { allPages.sort((a, b) => {