diff --git a/lib/db/getSiteData.js b/lib/db/getSiteData.js index ef2f2389..74b7ad3c 100755 --- a/lib/db/getSiteData.js +++ b/lib/db/getSiteData.js @@ -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 })