mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-22 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'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
|
||||
import Link from 'next/link'
|
||||
|
||||
/**
|
||||
@@ -17,10 +15,6 @@ export default function BlogListArchive({ archiveTitle, archivePosts }) {
|
||||
|
||||
<ul>
|
||||
{archivePosts[archiveTitle].map(post => {
|
||||
const url = checkContainHttp(post.slug)
|
||||
? sliceUrlFromHttp(post.slug)
|
||||
: `${siteConfig('SUB_PATH', '')}/${post.slug}`
|
||||
|
||||
return (
|
||||
<li
|
||||
key={post.id}
|
||||
@@ -28,7 +22,7 @@ export default function BlogListArchive({ archiveTitle, archivePosts }) {
|
||||
<div id={post?.publishDay}>
|
||||
<span className='text-gray-400'>{post?.publishDay}</span>
|
||||
<Link
|
||||
href={url}
|
||||
href={post?.href}
|
||||
className='dark:text-gray-400 dark:hover:text-gray-300 overflow-x-hidden hover:underline cursor-pointer text-gray-600'>
|
||||
{post.title}
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user