优化单页面JSON文件
This commit is contained in:
tangly1024
2021-12-15 12:56:40 +08:00
parent f8694456ef
commit ec768dec47
2 changed files with 2 additions and 0 deletions

View File

@@ -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)
}

View File

@@ -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)
}