diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js index a3a40b7d..0bbcd937 100644 --- a/themes/hexo/components/ArticleRecommend.js +++ b/themes/hexo/components/ArticleRecommend.js @@ -1,9 +1,9 @@ -import Link from 'next/link' -import CONFIG from '../config' +import LazyImage from '@/components/LazyImage' import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' -import LazyImage from '@/components/LazyImage' import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import Link from 'next/link' +import CONFIG from '../config' /** * 关联推荐文章 @@ -13,50 +13,52 @@ import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' export default function ArticleRecommend({ recommendPosts, siteInfo }) { const { locale } = useGlobal() - if ( - !siteConfig('HEXO_ARTICLE_RECOMMEND', null, CONFIG) || - !recommendPosts || - recommendPosts.length === 0 - ) { + if (!siteConfig('HEXO_ARTICLE_RECOMMEND', null, CONFIG) || !recommendPosts || recommendPosts.length === 0) { return <> } return ( -
-
-
- - {locale.COMMON.RELATE_POSTS} -
-
-
- {recommendPosts.map(post => { - const headerImage = post?.pageCoverThumbnail - ? post.pageCoverThumbnail - : siteInfo?.pageCover - const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` - - return ( - ( - -
-
-
- {post.title} -
-
- -
- - ) - ) - })} -
+
+
+
+ + {locale.COMMON.RELATE_POSTS}
+
+
+ {recommendPosts.map(post => { + const headerImage = post?.pageCoverThumbnail ? post.pageCoverThumbnail : siteInfo?.pageCover + const url = checkContainHttp(post.slug) + ? sliceUrlFromHttp(post.slug) + : `${siteConfig('SUB_PATH', '')}/${post.slug}` + + return ( + +
+
+
+ {post.title} +
+
+ + + {/* 卡片的阴影遮罩,为了凸显图片上的文字 */} +
+
+
+
+ + ) + })} +
+
) }