支持外部链接跳转

This commit is contained in:
tangly1024
2022-03-08 15:24:57 +08:00
parent 3e22d62af5
commit e2502981ce
2 changed files with 8 additions and 2 deletions

View File

@@ -97,7 +97,11 @@ async function getCustomNav ({ notionPageData }) {
const customNav = [] const customNav = []
if (allPage && allPage.length > 0) { if (allPage && allPage.length > 0) {
allPage.forEach(p => { 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 return customNav

View File

@@ -26,8 +26,10 @@ export async function getStaticPaths () {
const from = 'slug-paths' const from = 'slug-paths'
const { allPosts } = await getGlobalNotionData({ from, pageType: ['Page'] }) const { allPosts } = await getGlobalNotionData({ from, pageType: ['Page'] })
const filterPosts = allPosts?.filter(e => e?.slug?.indexOf('http') !== 0) || []
return { return {
paths: allPosts.map(row => ({ params: { slug: row.slug } })), paths: filterPosts.map(row => ({ params: { slug: row.slug } })),
fallback: true fallback: true
} }
} }