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:
anime
2025-07-08 23:04:41 +08:00
parent 645edd7ead
commit b16512ac9a
4 changed files with 17 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { siteConfig } from '@/lib/config'
import { checkStartWithHttp } from '@/lib/utils'
import { isHttpLink } from '@/lib/utils'
import Link from 'next/link'
import { useRouter } from 'next/router'
import NotionIcon from './NotionIcon'
@@ -23,7 +23,7 @@ const BlogPostCard = ({ post, className }) => {
return (
<Link
href={post?.href}
target={checkStartWithHttp(post.slug) ? '_blank' : '_self'}
target={isHttpLink(post.slug) ? '_blank' : '_self'}
passHref>
<div
key={post.id}