mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 07:26:49 +00:00
二级菜单,部分
This commit is contained in:
@@ -95,8 +95,13 @@ function getCustomNav({ allPages }) {
|
||||
return customNav
|
||||
}
|
||||
|
||||
function getCustomMenu({ collectionData }) {
|
||||
const menuPages = collectionData.filter(post => (post.type === BLOG.NOTION_PROPERTY_NAME.type_menu || post.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu) && post.status === 'Published')
|
||||
/**
|
||||
* 获取自定义菜单
|
||||
* @param {*} allPages
|
||||
* @returns
|
||||
*/
|
||||
function getCustomMenu({ allPages }) {
|
||||
const menuPages = allPages.filter(post => (post.type === BLOG.NOTION_PROPERTY_NAME.type_menu || post.type === BLOG.NOTION_PROPERTY_NAME.type_sub_menu) && post.status === BLOG.NOTION_PROPERTY_NAME.status_publish)
|
||||
const menus = []
|
||||
if (menuPages && menuPages.length > 0) {
|
||||
menuPages.forEach(e => {
|
||||
@@ -216,14 +221,12 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
// 文章计数
|
||||
let postCount = 0
|
||||
const allPages = collectionData.filter(post => {
|
||||
if (post.type === 'Post' && post.status === 'Published') {
|
||||
if (post.type === BLOG.NOTION_PROPERTY_NAME.type_post && post.status === BLOG.NOTION_PROPERTY_NAME.status_publish) {
|
||||
postCount++
|
||||
}
|
||||
return post &&
|
||||
post.type &&
|
||||
(post.type === 'Post' || post.type === 'Page') &&
|
||||
(post.status === 'Published' || post.status === 'Invisible') &&
|
||||
(!post.slug.startsWith('http'))
|
||||
(!post?.slug?.startsWith('http')) &&
|
||||
(post?.status === BLOG.NOTION_PROPERTY_NAME.status_publish || post?.status === BLOG.NOTION_PROPERTY_NAME.status_invisible)
|
||||
})
|
||||
|
||||
// Sort by date
|
||||
@@ -241,7 +244,7 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
|
||||
const siteInfo = getBlogInfo({ collection, block })
|
||||
const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') })
|
||||
// 新的菜单
|
||||
const customMenu = getCustomMenu({ collectionData })
|
||||
const customMenu = await getCustomMenu({ allPages })
|
||||
const latestPosts = getLatestPosts({ allPages, from, latestPostCount: 5 })
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user