diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index 95796c2f62..53d7ce8765 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -6,9 +6,9 @@ import formatDate from '../utils/formatDate' import md5 from 'js-md5' import { siteConfig } from '../config' import { - checkStartWithHttp, - convertUrlStartWithOneSlash, - getLastSegmentFromUrl + checkStartWithHttp, + convertUrlStartWithOneSlash, + getLastSegmentFromUrl } from '../utils' import { extractLangPrefix } from '../utils/pageId' import { mapImgUrl } from './mapImage' @@ -290,5 +290,10 @@ function generateCustomizeSlug(postProperties, NOTION_CONFIG) { if (fullPrefix.endsWith('/')) { fullPrefix = fullPrefix.substring(0, fullPrefix.length - 1) // 去掉尾部部的"/" } - return `${fullPrefix}/${postProperties.slug ?? postProperties.id}` + + if(fullPrefix){ + return `${fullPrefix}/${postProperties.slug ?? postProperties.id}` + }else{ + return `${postProperties.slug ?? postProperties.id}` + } } diff --git a/pages/[prefix]/index.js b/pages/[prefix]/index.js index 4231a18189..dc480fcc53 100644 --- a/pages/[prefix]/index.js +++ b/pages/[prefix]/index.js @@ -129,7 +129,7 @@ export async function getStaticProps({ params: { prefix }, locale }) { fullSlug += '.html' } } - + // 在列表内查找文章 props.post = props?.allPages?.find(p => { return (