mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-24 07:26:50 +00:00
slug 链接调试
This commit is contained in:
@@ -118,11 +118,14 @@ export default async function getPageProperties(
|
||||
}) || []
|
||||
delete properties.content
|
||||
|
||||
// 处理URL ,为文章添加一个href字段,专门用来跳转访问
|
||||
// 处理URL
|
||||
// 1.按照用户配置的URL_PREFIX 转换一下slug
|
||||
// 2.为文章添加一个href字段,存储最终调整的路径
|
||||
if (properties.type === 'Post') {
|
||||
properties.href = BLOG.POST_URL_PREFIX
|
||||
? generateCustomizeUrl(properties)
|
||||
: properties.slug ?? properties.id
|
||||
if (BLOG.POST_URL_PREFIX) {
|
||||
properties.slug = generateCustomizeSlug(properties)
|
||||
}
|
||||
properties.href = properties.slug ?? properties.id
|
||||
} else if (properties.type === 'Page') {
|
||||
properties.href = properties.slug ?? properties.id
|
||||
} else if (properties.type === 'Menu' || properties.type === 'SubMenu') {
|
||||
@@ -206,7 +209,7 @@ function mapProperties(properties) {
|
||||
* @param {*} postProperties
|
||||
* @returns
|
||||
*/
|
||||
function generateCustomizeUrl(postProperties) {
|
||||
function generateCustomizeSlug(postProperties) {
|
||||
let fullPrefix = ''
|
||||
const allSlugPatterns = BLOG.POST_URL_PREFIX.split('/')
|
||||
allSlugPatterns.forEach((pattern, idx) => {
|
||||
|
||||
Reference in New Issue
Block a user