mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-22 15:09:43 +00:00
Merge pull request #2550 from tangly1024/fix/url-prefix-empty-to-open
修复配置了prefix后,部分页面无法打开的bug
This commit is contained in:
@@ -6,9 +6,9 @@ import formatDate from '../utils/formatDate'
|
|||||||
import md5 from 'js-md5'
|
import md5 from 'js-md5'
|
||||||
import { siteConfig } from '../config'
|
import { siteConfig } from '../config'
|
||||||
import {
|
import {
|
||||||
checkStartWithHttp,
|
checkStartWithHttp,
|
||||||
convertUrlStartWithOneSlash,
|
convertUrlStartWithOneSlash,
|
||||||
getLastSegmentFromUrl
|
getLastSegmentFromUrl
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { extractLangPrefix } from '../utils/pageId'
|
import { extractLangPrefix } from '../utils/pageId'
|
||||||
import { mapImgUrl } from './mapImage'
|
import { mapImgUrl } from './mapImage'
|
||||||
@@ -290,5 +290,10 @@ function generateCustomizeSlug(postProperties, NOTION_CONFIG) {
|
|||||||
if (fullPrefix.endsWith('/')) {
|
if (fullPrefix.endsWith('/')) {
|
||||||
fullPrefix = fullPrefix.substring(0, fullPrefix.length - 1) // 去掉尾部部的"/"
|
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}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export async function getStaticProps({ params: { prefix }, locale }) {
|
|||||||
fullSlug += '.html'
|
fullSlug += '.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在列表内查找文章
|
// 在列表内查找文章
|
||||||
props.post = props?.allPages?.find(p => {
|
props.post = props?.allPages?.find(p => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user