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 => (