mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-05 15:10:26 +00:00
refactor: rename checkStartWithHttp to isHttpLink
- Update function name and implementation in utils/index.js - Replace all occurrences in getPageProperties.js, post.js, and BlogPostCard.js - Improve function documentation and use regex for better URL matching
This commit is contained in:
@@ -4,7 +4,7 @@ import formatDate from '../utils/formatDate'
|
||||
// import { createHash } from 'crypto'
|
||||
import md5 from 'js-md5'
|
||||
import { siteConfig } from '../config'
|
||||
import { checkStartWithHttp, convertUrlStartWithOneSlash, getLastSegmentFromUrl, isMailOrTelLink } from '../utils'
|
||||
import { convertUrlStartWithOneSlash, getLastSegmentFromUrl, isHttpLink, isMailOrTelLink } from '../utils'
|
||||
import { extractLangPrefix } from '../utils/pageId'
|
||||
import { mapImgUrl } from './mapImage'
|
||||
import notionAPI from '@/lib/notion/getNotionAPI'
|
||||
@@ -187,7 +187,7 @@ export function adjustPageProperties(properties, NOTION_CONFIG) {
|
||||
}
|
||||
|
||||
// http or https 开头的视为外链
|
||||
if (checkStartWithHttp(properties?.href)) {
|
||||
if (isHttpLink(properties?.href)) {
|
||||
properties.href = properties?.slug
|
||||
properties.target = '_blank'
|
||||
} else if (isMailOrTelLink(properties?.href)) {
|
||||
@@ -238,7 +238,7 @@ export function adjustPageProperties(properties, NOTION_CONFIG) {
|
||||
*/
|
||||
function generateCustomizeSlug(postProperties, NOTION_CONFIG) {
|
||||
// 外链不处理
|
||||
if (checkStartWithHttp(postProperties.slug)) {
|
||||
if (isHttpLink(postProperties.slug)) {
|
||||
return postProperties.slug
|
||||
}
|
||||
let fullPrefix = ''
|
||||
|
||||
Reference in New Issue
Block a user