From ec768dec47d40f384ca0fe0d740be9c842f8887f Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 15 Dec 2021 12:56:40 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E4=BC=98=E5=8C=96=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2JSON=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getAllPosts.js | 1 + pages/article/[slug].js | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/notion/getAllPosts.js b/lib/notion/getAllPosts.js index b51b181d..0d10d0de 100644 --- a/lib/notion/getAllPosts.js +++ b/lib/notion/getAllPosts.js @@ -37,6 +37,7 @@ export async function getAllPosts ({ notionPageData, from, includePage = false } properties.tagItems = properties?.tags?.map(tag => { return { name: tag, color: tagOptions.find(t => t.value === tag)?.color || 'gray' } }) || [] + delete properties.content data.push(properties) } diff --git a/pages/article/[slug].js b/pages/article/[slug].js index bc9e7688..8356a5d0 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -172,6 +172,7 @@ export async function getStaticProps ({ params: { slug } }) { const blockMap = await getPostBlocks(post.id, 'slug') post.toc = [] if (blockMap) { + post.content = Object.keys(blockMap.block) post.toc = getPageTableOfContents(post, blockMap) }