多语言的小调整

This commit is contained in:
tangly1024
2024-06-15 12:16:32 +08:00
parent 54978ba2f3
commit 30d3843b9e
3 changed files with 30 additions and 3 deletions

View File

@@ -8,8 +8,10 @@ import { siteConfig } from '../config'
import {
checkStartWithHttp,
convertUrlStartWithOneSlash,
getLastSegmentFromUrl,
sliceUrlFromHttp
} from '../utils'
import { extractLangPrefix } from '../utils/pageId'
import { mapImgUrl } from './mapImage'
/**
@@ -208,6 +210,18 @@ export function adjustPageProperties(properties, NOTION_CONFIG) {
properties.target = '_self'
}
// 如果跳转链接是多语言,则在新窗口打开
if (BLOG.NOTION_PAGE_ID.indexOf(',') > 0) {
const siteIds = BLOG.NOTION_PAGE_ID.split(',')
for (let index = 0; index < siteIds.length; index++) {
const siteId = siteIds[index]
const prefix = extractLangPrefix(siteId)
if (getLastSegmentFromUrl(properties.href) === prefix) {
properties.target = '_blank'
}
}
}
// 密码字段md5
properties.password = properties.password
? md5(properties.slug + properties.password)