@@ -3,7 +3,7 @@ import { siteConfig } from '@/lib/config'
33import { useGlobal } from '@/lib/global'
44import algoliasearch from 'algoliasearch'
55import throttle from 'lodash/throttle'
6- import Link from 'next/link '
6+ import SmartLink from '@/components/SmartLink '
77import { useRouter } from 'next/router'
88import {
99 Fragment ,
@@ -104,7 +104,8 @@ export default function AlgoliaSearchModal({ cRef }) {
104104 // 跳转Search结果
105105 const onJumpSearchResult = ( ) => {
106106 if ( searchResults . length > 0 ) {
107- window . location . href = `${ siteConfig ( 'SUB_PATH' , '' ) } /${ searchResults [ activeIndex ] . slug } `
107+ const searchResult = searchResults [ activeIndex ]
108+ window . location . href = `${ siteConfig ( 'SUB_PATH' , '' ) } /${ searchResult . slug || searchResult . objectID } `
108109 }
109110 }
110111
@@ -246,12 +247,12 @@ export default function AlgoliaSearchModal({ cRef }) {
246247 id = 'search-wrapper'
247248 className = { `${
248249 isModalOpen ? 'opacity-100' : 'invisible opacity-0 pointer-events-none'
249- } z-30 fixed h-screen w-screen left-0 top-0 sm:mt-12 flex items-start justify-center mt-0`} >
250+ } z-30 fixed h-screen w-screen left-0 top-0 sm:mt-[10vh] flex items-start justify-center mt-0`} >
250251 { /* 模态框 */ }
251252 < div
252253 className = { `${
253254 isModalOpen ? 'opacity-100' : 'invisible opacity-0 translate-y-10'
254- } flex flex-col justify-between w-full min-h-[10rem] h-full md:h-fit max-w-xl dark:bg-hexo-black-gray dark:border-gray-800 bg-white dark:bg- p-5 rounded-lg z-50 shadow border hover:border-blue-600 duration-300 transition-all `} >
255+ } max-h-[80vh] flex flex-col justify-between w-full min-h-[10rem] h-full md:h-fit max-w-xl dark:bg-hexo-black-gray dark:border-gray-800 bg-white dark:bg- p-5 rounded-lg z-50 shadow border hover:border-blue-600 duration-300 transition-all `} >
255256 < div className = 'flex justify-between items-center' >
256257 < div className = 'text-2xl text-blue-600 dark:text-yellow-600 font-bold' >
257258 搜索
@@ -356,7 +357,7 @@ function TagGroups() {
356357 < div id = 'tags-group' className = 'dark:border-gray-700 space-y-2' >
357358 { firstTenTags ?. map ( ( tag , index ) => {
358359 return (
359- < Link
360+ < SmartLink
360361 passHref
361362 key = { index }
362363 href = { `/tag/${ encodeURIComponent ( tag . name ) } ` }
@@ -372,7 +373,7 @@ function TagGroups() {
372373 < > </ >
373374 ) }
374375 </ div >
375- </ Link >
376+ </ SmartLink >
376377 )
377378 } ) }
378379 </ div >
0 commit comments