feat: change all Link component to SmartLink

Close #3512
This commit is contained in:
anime
2025-07-24 15:06:39 +08:00
parent fc4817e669
commit ba951cd2aa
338 changed files with 1381 additions and 1381 deletions

View File

@@ -1,6 +1,6 @@
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import CONFIG from '../config'
import TagItemMini from './TagItemMini'
@@ -44,12 +44,12 @@ const BlogPostArchive = ({ posts = [], archiveTitle, siteInfo }) => {
{/* 图片封面 */}
{showPageCover && (
<div>
<Link href={post?.href} passHref legacyBehavior>
<SmartLink href={post?.href} passHref legacyBehavior>
<LazyImage
className={'rounded-xl bg-center bg-cover w-40 h-24'}
src={post?.pageCoverThumbnail}
/>
</Link>
</SmartLink>
</div>
)}
@@ -60,24 +60,24 @@ const BlogPostArchive = ({ posts = [], archiveTitle, siteInfo }) => {
{post?.category && (
<div
className={`flex items-center ${showPreview ? 'justify-center' : 'justify-start'} hidden md:block flex-wrap dark:text-gray-500 text-gray-600 `}>
<Link
<SmartLink
passHref
href={`/category/${post.category}`}
className='cursor-pointer text-xs font-normal menu-link hover:text-indigo-700 dark:text-gray-600 transform'>
{post.category}
</Link>
</SmartLink>
</div>
)}
{/* 标题 */}
<Link
<SmartLink
href={post?.href}
passHref
className={
' group-hover:text-indigo-700 group-hover:dark:text-indigo-400 text-black dark:text-gray-100 dark:group-hover:text-yellow-600 line-clamp-2 replace cursor-pointer text-xl font-extrabold leading-tight'
}>
<span className='menu-link '>{post.title}</span>
</Link>
</SmartLink>
</div>
{/* 摘要 */}

View File

@@ -1,7 +1,7 @@
import LazyImage from '@/components/LazyImage'
import NotionIcon from './NotionIcon'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import CONFIG from '../config'
import TagItemMini from './TagItemMini'
@@ -38,7 +38,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
}>
{/* 图片封面 */}
{showPageCover && (
<Link href={post?.href} passHref legacyBehavior>
<SmartLink href={post?.href} passHref legacyBehavior>
<div
className={
(POST_TWO_COLS ? ' 2xl:w-full' : '') +
@@ -51,7 +51,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
className='h-full w-full object-cover group-hover:scale-105 group-hover:brightness-75 transition-all duration-500 ease-in-out' //宽高都调整为自适应,保证封面居中
/>
</div>
</Link>
</SmartLink>
)}
{/* 文字区块 */}
@@ -65,17 +65,17 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
{post?.category && (
<div
className={`flex mb-1 items-center ${showPreview ? 'justify-center' : 'justify-start'} hidden md:block flex-wrap dark:text-gray-300 text-gray-600 hover:text-indigo-700 dark:hover:text-yellow-500`}>
<Link
<SmartLink
passHref
href={`/category/${post.category}`}
className='cursor-pointer text-xs font-normal menu-link '>
{post.category}
</Link>
</SmartLink>
</div>
)}
{/* 标题和图标 */}
<Link
<SmartLink
href={post?.href}
passHref
className={
@@ -88,7 +88,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
/>
)}
<span className='menu-link '>{post.title}</span>
</Link>
</SmartLink>
</header>
{/* 摘要 */}

View File

@@ -1,6 +1,6 @@
import { ChevronDoubleLeft, ChevronDoubleRight } from '@/components/HeroIcons'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useRef, useState } from 'react'
@@ -55,11 +55,11 @@ export default function CategoryBar(props) {
<ChevronDoubleRight className={'w-5 h-5'} />
)}
</div>
<Link
<SmartLink
href='/category'
className='whitespace-nowrap font-bold text-gray-900 dark:text-white transition-colors duration-200 hover:text-indigo-600 dark:hover:text-yellow-600'>
{locale.MENU.CATEGORY}
</Link>
</SmartLink>
</div>
</div>
)
@@ -77,7 +77,7 @@ const MenuItem = ({ href, name }) => {
return (
<div
className={`whitespace-nowrap mr-2 duration-200 transition-all font-bold px-2 py-0.5 rounded-md text-gray-900 dark:text-white hover:text-white hover:bg-indigo-600 dark:hover:bg-yellow-600 ${selected ? 'text-white bg-indigo-600 dark:bg-yellow-600' : ''}`}>
<Link href={href}>{name}</Link>
<SmartLink href={href}>{name}</SmartLink>
</div>
)
}

View File

@@ -1,4 +1,4 @@
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
const CategoryGroup = ({ currentCategory, categories }) => {
if (!categories) {
@@ -9,7 +9,7 @@ const CategoryGroup = ({ currentCategory, categories }) => {
{categories.map(category => {
const selected = currentCategory === category.name
return (
<Link
<SmartLink
key={category.name}
href={`/category/${category.name}`}
passHref
@@ -20,7 +20,7 @@ const CategoryGroup = ({ currentCategory, categories }) => {
<div> <i className={`mr-2 fas ${selected ? 'fa-folder-open' : 'fa-folder'}`} />{category.name}({category.count})</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -3,7 +3,7 @@ import { ArrowSmallRight, PlusSmall } from '@/components/HeroIcons'
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useImperativeHandle, useRef, useState } from 'react'
import CONFIG from '../config'
@@ -176,7 +176,7 @@ function GroupMenu() {
return (
<div className='h-[165px] select-none xl:h-20 flex flex-col justify-between xl:space-y-0 xl:flex-row w-28 lg:w-48 xl:w-full xl:flex-nowrap xl:space-x-3'>
<Link
<SmartLink
href={url_1}
className='group relative overflow-hidden bg-gradient-to-r from-blue-500 to-blue-400 flex h-20 justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in'>
<div className='font-bold lg:text-lg pl-5 relative -mt-2'>
@@ -186,8 +186,8 @@ function GroupMenu() {
<div className='hidden lg:block absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0'>
<i className='fa-solid fa-star text-4xl'></i>
</div>
</Link>
<Link
</SmartLink>
<SmartLink
href={url_2}
className='group relative overflow-hidden bg-gradient-to-r from-red-500 to-yellow-500 flex h-20 justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in'>
<div className='font-bold lg:text-lg pl-5 relative -mt-2'>
@@ -197,9 +197,9 @@ function GroupMenu() {
<div className='hidden lg:block absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0'>
<i className='fa-solid fa-fire-flame-curved text-4xl'></i>
</div>
</Link>
</SmartLink>
{/* 第三个标签在小屏上不显示 */}
<Link
<SmartLink
href={url_3}
className='group relative overflow-hidden bg-gradient-to-r from-teal-300 to-cyan-300 hidden h-20 xl:flex justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in'>
<div className='font-bold text-lg pl-5 relative -mt-2'>
@@ -209,7 +209,7 @@ function GroupMenu() {
<div className='absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0'>
<i className='fa-solid fa-book-bookmark text-4xl '></i>
</div>
</Link>
</SmartLink>
</div>
)
}
@@ -239,7 +239,7 @@ function TopGroup(props) {
className='w-full flex space-x-3 xl:space-x-0 xl:grid xl:grid-cols-3 xl:gap-3 xl:h-[342px]'>
{topPosts?.map((p, index) => {
return (
<Link href={`${siteConfig('SUB_PATH', '')}/${p?.slug}`} key={index}>
<SmartLink href={`${siteConfig('SUB_PATH', '')}/${p?.slug}`} key={index}>
<div className='cursor-pointer h-[164px] group relative flex flex-col w-52 xl:w-full overflow-hidden shadow bg-white dark:bg-black dark:text-white rounded-xl'>
<LazyImage
priority={index === 0}
@@ -255,7 +255,7 @@ function TopGroup(props) {
{locale.COMMON.RECOMMEND_BADGES}
</div>
</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -1,7 +1,7 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import { RecentComments } from '@waline/client'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useEffect, useState } from 'react'
/**
@@ -49,14 +49,14 @@ const HexoRecentComments = props => {
dangerouslySetInnerHTML={{ __html: comment.comment }}
/>
<div className='dark:text-gray-400 text-gray-400 text-sm text-right cursor-pointer hover:text-red-500 hover:underline pt-1 pr-2'>
<Link
<SmartLink
href={{
pathname: comment.url,
hash: comment.objectId,
query: { target: 'comment' }
}}>
--{comment.nick}
</Link>
</SmartLink>
</div>
</div>
))}

View File

@@ -1,7 +1,7 @@
import { ArrowRightCircle } from '@/components/HeroIcons'
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useState } from 'react'
import CONFIG from '../config'
@@ -50,16 +50,16 @@ export function InfoCard(props) {
{/* 两个社交按钮 */}
{url1 && (
<div className='w-10 text-center bg-indigo-400 p-2 rounded-full transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
<Link href={url1}>
<SmartLink href={url1}>
<i className={icon1} />
</Link>
</SmartLink>
</div>
)}
{url2 && (
<div className='bg-indigo-400 p-2 rounded-full w-10 items-center flex justify-center transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
<Link href={url2}>
<SmartLink href={url2}>
<i className={icon2} />
</Link>
</SmartLink>
</div>
)}
</div>
@@ -81,7 +81,7 @@ function MoreButton() {
return <></>
}
return (
<Link href={url3}>
<SmartLink href={url3}>
<div
className={
'group bg-indigo-400 dark:bg-yellow-500 hover:bg-white dark:hover:bg-black hover:text-black dark:hover:text-white flex items-center transition-colors duration-200 py-2 px-3 rounded-full space-x-1'
@@ -93,7 +93,7 @@ function MoreButton() {
/>
<div className='font-bold'>{text3}</div>
</div>
</Link>
</SmartLink>
)
}

View File

@@ -1,5 +1,5 @@
import LazyImage from '@/components/LazyImage'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
/**
* 最新文章列表
@@ -22,7 +22,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
: siteInfo?.pageCover
return (
<Link
<SmartLink
key={post.id}
passHref
title={post.title}
@@ -42,7 +42,7 @@ const LatestPostsGroup = ({ latestPosts, siteInfo }) => {
}>
<div className='line-clamp-2 menu-link'>{post.title}</div>
</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -2,7 +2,7 @@ import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
// import Image from 'next/image'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
/**
@@ -33,7 +33,7 @@ export default function LatestPostsGroupMini({ latestPosts, siteInfo }) {
: siteInfo?.pageCover
return (
<Link
<SmartLink
key={post.id}
title={post.title}
href={post?.href}
@@ -56,7 +56,7 @@ export default function LatestPostsGroupMini({ latestPosts, siteInfo }) {
<div className='text-gray-400'>{post.lastEditedDay}</div>
</div>
</div>
</Link>
</SmartLink>
)
})}
</>

View File

@@ -1,12 +1,12 @@
import { Home } from '@/components/HeroIcons'
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
const Logo = props => {
const { siteInfo } = props
return (
<Link href='/' passHref legacyBehavior>
<SmartLink href='/' passHref legacyBehavior>
<div className='flex flex-nowrap items-center cursor-pointer font-extrabold'>
<LazyImage
src={siteInfo?.icon}
@@ -24,7 +24,7 @@ const Logo = props => {
</div>
</div>
</div>
</Link>
</SmartLink>
)
}
export default Logo

View File

@@ -1,6 +1,6 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import CONFIG from '../config'
const MenuGroupCard = props => {
@@ -39,7 +39,7 @@ const MenuGroupCard = props => {
if (link.show) {
return (
<div key={index} className=''>
<Link
<SmartLink
title={link.href}
href={link.href}
target={link?.target}
@@ -50,7 +50,7 @@ const MenuGroupCard = props => {
<div>{link.name} :</div>
<div className='font-semibold'>{link.slot}</div>
</>
</Link>
</SmartLink>
</div>
)
} else {

View File

@@ -1,5 +1,5 @@
import Collapse from '@/components/Collapse'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useState } from 'react'
/**
@@ -31,7 +31,7 @@ export const MenuItemCollapse = ({ link }) => {
className='select-none w-full p-2 border dark:border-gray-600 rounded-lg text-left dark:bg-[#1e1e1e]'
onClick={toggleShow}>
{!hasSubMenu && (
<Link
<SmartLink
href={link?.href}
target={link?.target}
className='font-extralight flex justify-between pl-2 pr-4 dark:text-gray-200 no-underline tracking-widest'>
@@ -39,7 +39,7 @@ export const MenuItemCollapse = ({ link }) => {
{link?.icon && <i className={link.icon + ' mr-4'} />}
{link?.name}
</span>
</Link>
</SmartLink>
)}
{hasSubMenu && (
<div
@@ -63,12 +63,12 @@ export const MenuItemCollapse = ({ link }) => {
<div
key={index}
className='dark:bg-hexo-black-gray dark:text-gray-200 text-left px-3 justify-start bg-gray-50 hover:bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200 py-3 pr-6'>
<Link href={sLink.href} target={link?.target}>
<SmartLink href={sLink.href} target={link?.target}>
<span className='text-sm ml-4 whitespace-nowrap'>
{link?.icon && <i className={sLink.icon + ' mr-2'} />}{' '}
{sLink.title}
</span>
</Link>
</SmartLink>
</div>
)
})}

View File

@@ -1,4 +1,4 @@
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useState } from 'react'
export const MenuItemDrop = ({ link }) => {
@@ -15,12 +15,12 @@ export const MenuItemDrop = ({ link }) => {
onMouseOut={() => changeShow(false)}>
{/* 不含子菜单 */}
{!hasSubMenu && (
<Link
<SmartLink
target={link?.target}
href={link?.href}
className=' hover:bg-black hover:bg-opacity-10 rounded-2xl flex justify-center items-center px-3 py-1 no-underline tracking-widest'>
{link?.icon && <i className={link?.icon} />} {link?.name}
</Link>
</SmartLink>
)}
{/* 含子菜单的按钮 */}
{hasSubMenu && (
@@ -44,12 +44,12 @@ export const MenuItemDrop = ({ link }) => {
<li
key={index}
className='cursor-pointer hover:bg-blue-600 dark:hover:bg-yellow-600 hover:text-white text-gray-900 dark:text-gray-100 tracking-widest transition-all duration-200 py-1 pr-6 pl-3'>
<Link href={sLink.href} target={link?.target}>
<SmartLink href={sLink.href} target={link?.target}>
<span className='text-sm text-nowrap font-extralight'>
{link?.icon && <i className={sLink?.icon}> &nbsp; </i>}
{sLink.title}
</span>
</Link>
</SmartLink>
</li>
)
})}

View File

@@ -1,4 +1,4 @@
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
/**
* 首页导航大按钮组件
@@ -15,14 +15,14 @@ const NavButtonGroup = (props) => {
<nav id='home-nav-button' className={'w-full z-10 md:h-72 md:mt-6 xl:mt-32 px-5 py-2 mt-8 flex flex-wrap md:max-w-5xl space-y-2 md:space-y-1 md:flex justify-center max-h-80 overflow-auto'}>
{categoryOptions?.map(category => {
return (
<Link
<SmartLink
key={`${category.name}`}
title={`${category.name}`}
href={`/category/${category.name}`}
passHref
className='text-center w-full sm:w-4/5 md:mx-6 md:w-40 md:h-14 lg:h-20 h-14 justify-center items-center flex border-2 cursor-pointer rounded-lg glassmorphism hover:bg-white hover:text-black duration-200 font-bold hover:scale-105 transform'>
{category.name}
</Link>
</SmartLink>
)
})}
</nav>

View File

@@ -1,6 +1,6 @@
import { ChevronDoubleRight } from '@/components/HeroIcons'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useState } from 'react'
@@ -47,7 +47,7 @@ const PaginationNumber = ({ page, totalPage }) => {
{/* pc端分页按钮 */}
<div className='hidden lg:flex justify-between items-end mt-10 font-medium text-black duration-500 dark:text-gray-300 pt-3 space-x-2 overflow-x-auto'>
{/* 上一页 */}
<Link
<SmartLink
href={{
pathname:
currentPage === 2
@@ -63,7 +63,7 @@ const PaginationNumber = ({ page, totalPage }) => {
{locale.PAGINATION.PREV}
</div>
</div>
</Link>
</SmartLink>
{/* 分页 */}
<div className='flex items-center space-x-2'>
@@ -84,7 +84,7 @@ const PaginationNumber = ({ page, totalPage }) => {
</div>
{/* 下一页 */}
<Link
<SmartLink
href={{
pathname: `${pagePrefix}/page/${currentPage + 1}`,
query: router.query.s ? { s: router.query.s } : {}
@@ -97,14 +97,14 @@ const PaginationNumber = ({ page, totalPage }) => {
{locale.PAGINATION.NEXT}
</div>
</div>
</Link>
</SmartLink>
</div>
{/* 移动端分页 */}
<div className='lg:hidden w-full flex flex-row'>
{/* 上一页 */}
<Link
<SmartLink
href={{
pathname:
currentPage === 2
@@ -115,12 +115,12 @@ const PaginationNumber = ({ page, totalPage }) => {
rel='prev'
className={`${showPrev ? 'block' : 'hidden'} dark:text-white relative w-full flex-1 h-14 flex items-center transition-all duration-200 justify-center py-2 px-2 bg-white dark:bg-[#1e1e1e] border rounded-xl cursor-pointer`}>
{locale.PAGINATION.PREV}
</Link>
</SmartLink>
{showPrev && showNext && <div className='w-12'></div>}
{/* 下一页 */}
<Link
<SmartLink
href={{
pathname: `${pagePrefix}/page/${currentPage + 1}`,
query: router.query.s ? { s: router.query.s } : {}
@@ -128,7 +128,7 @@ const PaginationNumber = ({ page, totalPage }) => {
rel='next'
className={`${+showNext ? 'block' : 'hidden'} dark:text-white relative w-full flex-1 h-14 flex items-center transition-all duration-200 justify-center py-2 px-2 bg-white dark:bg-[#1e1e1e] border rounded-xl cursor-pointer`}>
{locale.PAGINATION.NEXT}
</Link>
</SmartLink>
</div>
</>
)
@@ -147,7 +147,7 @@ function getPageElement(page, currentPage, pagePrefix) {
return <></>
}
return (
<Link
<SmartLink
href={page === 1 ? `${pagePrefix}/` : `${pagePrefix}/page/${page}`}
key={page}
passHref
@@ -158,7 +158,7 @@ function getPageElement(page, currentPage, pagePrefix) {
' hover:border-indigo-600 dark:hover:bg-yellow-600 dark:border-gray-600 px-4 border py-2 rounded-lg drop-shadow-sm duration-200 transition-colors'
}>
{page}
</Link>
</SmartLink>
)
}

View File

@@ -1,6 +1,6 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import CONFIG from '../config'
@@ -63,7 +63,7 @@ export default function PostAdjacent({ prev, next }) {
<div id='article-end'>
{/* 移动端 */}
<section className='lg:hidden pt-8 text-gray-800 items-center text-xs md:text-sm flex flex-col m-1 '>
<Link
<SmartLink
href={`/${prev.slug}`}
passHref
className='cursor-pointer justify-between space-y-1 px-5 py-6 rounded-t-xl dark:bg-[#1e1e1e] border dark:border-gray-600 border-b-0 items-center dark:text-white flex flex-col w-full h-18 duration-200'>
@@ -71,8 +71,8 @@ export default function PostAdjacent({ prev, next }) {
<div className='flex justify-center items-center text-lg font-bold'>
{prev.title}
</div>
</Link>
<Link
</SmartLink>
<SmartLink
href={`/${next.slug}`}
passHref
className='cursor-pointer justify-between space-y-1 px-5 py-6 rounded-b-xl dark:bg-[#1e1e1e] border dark:border-gray-600 items-center dark:text-white flex flex-col w-full h-18 duration-200'>
@@ -80,7 +80,7 @@ export default function PostAdjacent({ prev, next }) {
<div className='flex justify-center items-center text-lg font-bold'>
{next.title}
</div>
</Link>
</SmartLink>
</section>
{/* 桌面端 */}
@@ -88,13 +88,13 @@ export default function PostAdjacent({ prev, next }) {
<div
id='pc-next-post'
className={`${isShow ? 'mb-5 opacity-100' : '-mb-24 opacity-0'} hidden md:block fixed z-40 right-10 bottom-4 duration-200 transition-all`}>
<Link
<SmartLink
href={`/${next.slug}`}
className='text-sm block p-4 w-72 h-28 cursor-pointer drop-shadow-xl duration transition-all dark:bg-[#1e1e1e] border dark:border-gray-600 bg-white dark:text-gray-300 dark:hover:text-yellow-600 hover:font-bold hover:text-blue-600 rounded-lg'>
<div className='font-semibold'>{locale.COMMON.NEXT_POST}</div>
<hr className='mt-2 mb-3' />
<div className='line-clamp-2'>{next?.title}</div>
</Link>
</SmartLink>
</div>
</div>
)

View File

@@ -1,6 +1,6 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import CONFIG from '../config'
@@ -28,9 +28,9 @@ export default function PostCopyright() {
<ul className='overflow-x-auto whitespace-nowrap text-sm dark:bg-gray-900 bg-gray-100 p-5 leading-8 border-l-2 border-indigo-500'>
<li>
<strong className='mr-2'>{locale.COMMON.AUTHOR}:</strong>
<Link href={'/about'} className='hover:underline'>
<SmartLink href={'/about'} className='hover:underline'>
{siteConfig('AUTHOR')}
</Link>
</SmartLink>
</li>
<li>
<strong className='mr-2'>{locale.COMMON.URL}:</strong>

View File

@@ -4,7 +4,7 @@ import NotionIcon from '@/components/NotionIcon'
import WordCount from '@/components/WordCount'
import { siteConfig } from '@/lib/config'
import { formatDateFmt } from '@/lib/utils/formatDate'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import WavesArea from './WavesArea'
/**
@@ -60,7 +60,7 @@ export default function PostHeader({ post, siteInfo, isDarkMode }) {
<div className='flex justify-center md:justify-start items-center gap-4'>
{post.category && (
<>
<Link
<SmartLink
href={`/category/${post.category}`}
className='mr-4'
passHref
@@ -68,14 +68,14 @@ export default function PostHeader({ post, siteInfo, isDarkMode }) {
<div className='cursor-pointer font-sm font-bold px-3 py-1 rounded-lg hover:bg-white text-white bg-blue-500 dark:bg-yellow-500 hover:text-blue-500 duration-200 '>
{post.category}
</div>
</Link>
</SmartLink>
</>
)}
{post.tagItems && (
<div className='hidden md:flex justify-center flex-nowrap overflow-x-auto'>
{post.tagItems.map((tag, index) => (
<Link
<SmartLink
key={index}
href={`/tag/${encodeURIComponent(tag.name)}`}
passHref
@@ -86,7 +86,7 @@ export default function PostHeader({ post, siteInfo, isDarkMode }) {
<HashTag className='text-gray-200 stroke-2 mr-0.5 w-3 h-3' />{' '}
{tag.name + (tag.count ? `(${tag.count})` : '')}{' '}
</div>
</Link>
</SmartLink>
))}
</div>
)}
@@ -111,13 +111,13 @@ export default function PostHeader({ post, siteInfo, isDarkMode }) {
</div>
{post?.type !== 'Page' && (
<>
<Link
<SmartLink
href={`/archive#${formatDateFmt(post?.publishDate, 'yyyy-MM')}`}
passHref
className='pl-1 mr-2 cursor-pointer hover:underline'>
<i className='fa-regular fa-calendar'></i>{' '}
{post?.publishDay}
</Link>
</SmartLink>
</>
)}

View File

@@ -1,7 +1,7 @@
import LazyImage from '@/components/LazyImage'
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import CONFIG from '../config'
/**
@@ -39,7 +39,7 @@ export default function PostRecommend({ recommendPosts, siteInfo }) {
: siteInfo?.pageCover
return (
<Link
<SmartLink
key={post?.id}
title={post?.title}
href={post?.href}
@@ -60,7 +60,7 @@ export default function PostRecommend({ recommendPosts, siteInfo }) {
<div className='h-full w-full absolute opacity-80 group-hover:opacity-100 transition-all duration-1000 bg-gradient-to-b from-transparent to-black'></div>
</div>
</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useEffect, useRef } from 'react'
import Card from './Card'
import SearchInput from './SearchInput'
@@ -30,7 +30,7 @@ export default function SearchNav(props) {
<div id="category-list" className="duration-200 flex flex-wrap mx-8">
{categoryOptions?.map(category => {
return (
<Link
<SmartLink
key={category.name}
href={`/category/${category.name}`}
passHref
@@ -43,7 +43,7 @@ export default function SearchNav(props) {
<i className="mr-4 fas fa-folder" />
{category.name}({category.count})
</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -1,7 +1,7 @@
import DarkModeButton from '@/components/DarkModeButton'
import { useGlobal } from '@/lib/global'
import { Dialog, Transition } from '@headlessui/react'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
import {
Fragment,
@@ -149,12 +149,12 @@ function DarkModeBlockButton() {
*/
function Button({ title, url }) {
return (
<Link
<SmartLink
href={url}
className={
'duration-200 hover:text-white hover:shadow-md flex cursor-pointer justify-between items-center px-2 py-2 border dark:border-gray-600 bg-white hover:bg-blue-600 dark:bg-[#1e1e1e] rounded-lg'
}>
{title}
</Link>
</SmartLink>
)
}

View File

@@ -1,4 +1,4 @@
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import { useRouter } from 'next/router'
/**
@@ -18,7 +18,7 @@ const TagGroups = ({ tags, className }) => {
{tags.map((tag, index) => {
const selected = currentTag === tag.name
return (
<Link passHref key={index} href={`/tag/${encodeURIComponent(tag.name)}`}
<SmartLink passHref key={index} href={`/tag/${encodeURIComponent(tag.name)}`}
className={'cursor-pointer inline-block whitespace-nowrap'}
>
<div className={`${className || ''}
@@ -34,7 +34,7 @@ const TagGroups = ({ tags, className }) => {
<></>
)}
</div>
</Link>
</SmartLink>
)
})}
</div>

View File

@@ -1,9 +1,9 @@
import { HashTag } from '@/components/HeroIcons'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
const TagItemMini = ({ tag, selected = false }) => {
return (
<Link
<SmartLink
key={tag}
href={selected ? '/' : `/tag/${encodeURIComponent(tag.name)}`}
passHref
@@ -14,7 +14,7 @@ const TagItemMini = ({ tag, selected = false }) => {
<HashTag className='stroke-2 mr-0.5 w-3 h-3' />{' '}
{tag.name + (tag.count ? `(${tag.count})` : '')}{' '}
</div>
</Link>
</SmartLink>
)
}

View File

@@ -1,6 +1,6 @@
import FlipCard from '@/components/FlipCard'
import { siteConfig } from '@/lib/config'
import Link from 'next/link'
import SmartLink from '@/components/SmartLink'
import CONFIG from '../config'
/**
@@ -32,11 +32,11 @@ export default function TouchMeCard() {
</div>
}
backContent={
<Link href={siteConfig('HEO_SOCIAL_CARD_URL', null, CONFIG)}>
<SmartLink href={siteConfig('HEO_SOCIAL_CARD_URL', null, CONFIG)}>
<div className='font-[1000] text-xl h-full'>
{siteConfig('HEO_SOCIAL_CARD_TITLE_3', null, CONFIG)}
</div>
</Link>
</SmartLink>
}
/>
</div>