mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
支持外部链接跳转
This commit is contained in:
@@ -97,7 +97,11 @@ async function getCustomNav ({ notionPageData }) {
|
||||
const customNav = []
|
||||
if (allPage && allPage.length > 0) {
|
||||
allPage.forEach(p => {
|
||||
customNav.push({ icon: p.icon || null, name: p.title, to: '/' + p.slug, show: true })
|
||||
if (p?.slug?.indexOf('http') === 0) {
|
||||
customNav.push({ icon: p.icon || null, name: p.title, to: p.slug, show: true })
|
||||
} else {
|
||||
customNav.push({ icon: p.icon || null, name: p.title, to: '/' + p.slug, show: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
return customNav
|
||||
|
||||
@@ -26,8 +26,10 @@ export async function getStaticPaths () {
|
||||
|
||||
const from = 'slug-paths'
|
||||
const { allPosts } = await getGlobalNotionData({ from, pageType: ['Page'] })
|
||||
const filterPosts = allPosts?.filter(e => e?.slug?.indexOf('http') !== 0) || []
|
||||
|
||||
return {
|
||||
paths: allPosts.map(row => ({ params: { slug: row.slug } })),
|
||||
paths: filterPosts.map(row => ({ params: { slug: row.slug } })),
|
||||
fallback: true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user