From e2502981ce171b4dcbc6cc6c08883ecc2ac22d4c Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 8 Mar 2022 15:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=96=E9=83=A8=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 6 +++++- pages/[slug].js | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 62691554..0ce1263f 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -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 diff --git a/pages/[slug].js b/pages/[slug].js index 4d1a13d9..8307c38f 100644 --- a/pages/[slug].js +++ b/pages/[slug].js @@ -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 } }