mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
external_menu
This commit is contained in:
@@ -9,6 +9,7 @@ import { getPostBlocks, getSingleBlock } from '@/lib/notion/getPostBlocks'
|
||||
import { compressImage, mapImgUrl } from '@/lib/notion/mapImage'
|
||||
import { deepClone } from '@/lib/utils'
|
||||
import { idToUuid } from 'notion-utils'
|
||||
import { siteConfig } from '../config'
|
||||
import { extractLangId, extractLangPrefix } from '../utils/pageId'
|
||||
|
||||
export { getAllTags } from '../notion/getAllTags'
|
||||
@@ -181,7 +182,7 @@ function getCustomNav({ allPages }) {
|
||||
* @param {*} allPages
|
||||
* @returns
|
||||
*/
|
||||
function getCustomMenu({ collectionData }) {
|
||||
function getCustomMenu({ collectionData, NOTION_CONFIG }) {
|
||||
const menuPages = collectionData.filter(
|
||||
post =>
|
||||
post.status === 'Published' &&
|
||||
@@ -192,7 +193,10 @@ function getCustomMenu({ collectionData }) {
|
||||
if (menuPages && menuPages.length > 0) {
|
||||
menuPages.forEach(e => {
|
||||
e.show = true
|
||||
if (e?.slug?.indexOf('http') === 0 && e?.slug?.indexOf(BLOG.LINK) < 0) {
|
||||
if (
|
||||
e?.slug?.indexOf('http') === 0 &&
|
||||
e?.slug?.indexOf(siteConfig('LINK', BLOG.LINK, NOTION_CONFIG)) < 0
|
||||
) {
|
||||
e.target = '_blank'
|
||||
e.to = e.slug
|
||||
} else {
|
||||
@@ -508,7 +512,7 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) {
|
||||
)
|
||||
})
|
||||
// 新的菜单
|
||||
const customMenu = await getCustomMenu({ collectionData })
|
||||
const customMenu = await getCustomMenu({ collectionData, NOTION_CONFIG })
|
||||
const latestPosts = getLatestPosts({ allPages, from, latestPostCount: 6 })
|
||||
const allNavPages = getNavPages({ allPages })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user