From 6e47044026e3643c0bc8552607ff1cc9b5163964 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 25 Mar 2024 12:27:32 +0800 Subject: [PATCH] fix fukasawa card link --- themes/fukasawa/components/BlogCard.js | 142 ++++++++++++++----------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index d54daaba..0f945f77 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -1,10 +1,10 @@ -import { siteConfig } from '@/lib/config' -import Link from 'next/link' -import TagItemMini from './TagItemMini' -import CONFIG from '../config' import LazyImage from '@/components/LazyImage' -import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' import NotionIcon from '@/components/NotionIcon' +import { siteConfig } from '@/lib/config' +import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils' +import Link from 'next/link' +import CONFIG from '../config' +import TagItemMini from './TagItemMini' /** * 文章列表卡片 @@ -12,13 +12,24 @@ import NotionIcon from '@/components/NotionIcon' * @returns */ const BlogCard = ({ index, post, showSummary, siteInfo }) => { - const showPreview = siteConfig('FUKASAWA_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap + const showPreview = + siteConfig('FUKASAWA_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap // fukasawa 强制显示图片 - if (siteConfig('FUKASAWA_POST_LIST_COVER_FORCE', null, CONFIG) && post && !post.pageCover) { + if ( + siteConfig('FUKASAWA_POST_LIST_COVER_FORCE', null, CONFIG) && + post && + !post.pageCover + ) { post.pageCoverThumbnail = siteInfo?.pageCover } - const showPageCover = siteConfig('FUKASAWA_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail - const FUKASAWA_POST_LIST_ANIMATION = siteConfig('FUKASAWA_POST_LIST_ANIMATION', null, CONFIG) + const showPageCover = + siteConfig('FUKASAWA_POST_LIST_COVER', null, CONFIG) && + post?.pageCoverThumbnail + const FUKASAWA_POST_LIST_ANIMATION = siteConfig( + 'FUKASAWA_POST_LIST_ANIMATION', + null, + CONFIG + ) // 动画样式 首屏卡片不用,后面翻出来的加动画 const aosProps = FUKASAWA_POST_LIST_ANIMATION @@ -30,63 +41,68 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { } : {} - const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}` + const url = checkContainHttp(post.slug) + ? sliceUrlFromHttp(post.slug) + : `${siteConfig('SUB_PATH', '')}/${post.slug}` return ( -
-
- {/* 封面图 */} - {showPageCover && ( -
- - - -
- )} - - {/* 文字部分 */} -
-

- - {post.title} - -

- - {(!showPreview || showSummary) && ( -
- {post.summary} -
- )} - - {/* 分类标签 */} -
- {post.category && - - {post.category} - } -
-
- {post.tagItems?.map((tag) => ( - - ))} -
-
-
-
+
+
+ {/* 封面图 */} + {showPageCover && ( + +
+
-
+ + )} + + {/* 文字部分 */} +
+

+ + {post.title} + +

+ + {(!showPreview || showSummary) && ( +
+ {post.summary} +
+ )} + + {/* 分类标签 */} +
+ {post.category && ( + + + {post.category} + + )} +
+
+ {post.tagItems?.map(tag => ( + + ))} +
+
+
+
+
+
) }