从Notion表格读取配置信息

This commit is contained in:
tangly1024
2023-10-30 22:39:06 +08:00
parent 18916e448f
commit ff552b7de4
4 changed files with 154 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ import getAllPageIds from './getAllPageIds'
import { getAllTags } from './getAllTags'
import getPageProperties from './getPageProperties'
import { mapImgUrl, compressImage } from './mapImage'
import { getConfigMapFromConfigPage } from './getNotionConfig'
/**
* 获取博客数据
@@ -283,15 +284,8 @@ 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)
}
// 站点配置优先读取配置表格否则读取blog.config.js 文件
const CONFIG = await getConfigMapFromConfigPage(collectionData) || BLOG
// Sort by date
if (BLOG.POSTS_SORT_BY === 'date') {
@@ -311,6 +305,7 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) {
const allNavPages = getNavPages({ allPages })
return {
CONFIG,
notice,
siteInfo,
allPages,