mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 23:16:49 +00:00
从Notion表格读取配置信息
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user