mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-19 23:16:48 +00:00
移除冗余的slug转换函数
This commit is contained in:
@@ -2,7 +2,6 @@ import LazyImage from '@/components/LazyImage'
|
||||
import NotionIcon from '@/components/NotionIcon'
|
||||
import TwikooCommentCount from '@/components/TwikooCommentCount'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
|
||||
@@ -15,9 +14,6 @@ const BlogItem = ({ post }) => {
|
||||
const showPageCover =
|
||||
siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG) &&
|
||||
post?.pageCoverThumbnail
|
||||
const url = checkContainHttp(post.slug)
|
||||
? sliceUrlFromHttp(post.slug)
|
||||
: `${siteConfig('SUB_PATH', '')}/${post.slug}`
|
||||
|
||||
return (
|
||||
<article
|
||||
@@ -25,7 +21,7 @@ const BlogItem = ({ post }) => {
|
||||
<div className={`${showPageCover ? 'md:w-7/12' : ''}`}>
|
||||
<h2 className='mb-4'>
|
||||
<Link
|
||||
href={`/${post.slug}`}
|
||||
href={post?.href}
|
||||
className='text-black dark:text-gray-100 text-xl md:text-2xl no-underline hover:underline'>
|
||||
{siteConfig('POST_TITLE_ICON') && (
|
||||
<NotionIcon icon={post.pageIcon} />
|
||||
@@ -72,7 +68,7 @@ const BlogItem = ({ post }) => {
|
||||
{/* 图片封面 */}
|
||||
{showPageCover && (
|
||||
<div className='md:w-5/12 w-full h-44 overflow-hidden p-1'>
|
||||
<Link href={url} passHref legacyBehavior>
|
||||
<Link href={post?.href} passHref legacyBehavior>
|
||||
<LazyImage
|
||||
src={post?.pageCoverThumbnail}
|
||||
className='w-full bg-cover hover:scale-110 duration-200'
|
||||
|
||||
Reference in New Issue
Block a user