From 1750d189ad259dee6d0d16481448ece795765cab Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 28 Aug 2024 12:46:25 +0800 Subject: [PATCH] =?UTF-8?q?HEO=20=E9=A6=96=E9=A1=B5=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8D=95=E5=88=97=E6=98=BE=E7=A4=BA=E5=8D=9A?= =?UTF-8?q?=E5=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/heo/components/BlogPostCard.js | 28 ++++++++++++++++++--- themes/heo/components/BlogPostListPage.js | 8 +++++- themes/heo/components/BlogPostListScroll.js | 13 +++++++--- themes/heo/config.js | 2 ++ 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/themes/heo/components/BlogPostCard.js b/themes/heo/components/BlogPostCard.js index afd11ce6..c015be17 100644 --- a/themes/heo/components/BlogPostCard.js +++ b/themes/heo/components/BlogPostCard.js @@ -1,11 +1,14 @@ import LazyImage from '@/components/LazyImage' import NotionIcon from '@/components/NotionIcon' import { siteConfig } from '@/lib/config' +import { useGlobal } from '@/lib/global' import Link from 'next/link' import CONFIG from '../config' import TagItemMini from './TagItemMini' const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { + const { NOTION_CONFIG } = useGlobal() + const showPreview = siteConfig('HEO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap if ( @@ -19,18 +22,34 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => { siteConfig('HEO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview + + const POST_TWO_COLS = siteConfig( + 'HEO_HOME_POST_TWO_COLS', + null, + NOTION_CONFIG + ) + return (
{/* 图片封面 */} {showPageCover && ( -
+
{ {/* 文字区块 */}
{/* 分类 */} diff --git a/themes/heo/components/BlogPostListPage.js b/themes/heo/components/BlogPostListPage.js index bf791ae5..e7629837 100644 --- a/themes/heo/components/BlogPostListPage.js +++ b/themes/heo/components/BlogPostListPage.js @@ -17,13 +17,19 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE + const POST_TWO_COLS = siteConfig( + 'HEO_HOME_POST_TWO_COLS', + null, + NOTION_CONFIG + ) if (!posts || posts.length === 0 || page > totalPage) { return } else { return (
{/* 文章列表 */} -
+
{posts?.map(post => ( { - const { NOTION_CONFIG } = useGlobal() + const { locale, NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const postsToShow = getListByPage(posts, page, POSTS_PER_PAGE) @@ -59,15 +59,20 @@ const BlogPostListScroll = ({ }) const targetRef = useRef(null) - const { locale } = useGlobal() - + const POST_TWO_COLS = siteConfig( + 'HEO_HOME_POST_TWO_COLS', + null, + NOTION_CONFIG + ) if (!postsToShow || postsToShow.length === 0) { return } else { return (
{/* 文章列表 */} -
+
+ {' '} {postsToShow.map(post => (