HEO 首页支持配置单列显示博客

This commit is contained in:
tangly1024.com
2024-08-28 12:46:25 +08:00
parent 9535807fbe
commit 1750d189ad
4 changed files with 43 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ const BlogPostListScroll = ({
showSummary = siteConfig('HEO_POST_LIST_SUMMARY', null, CONFIG),
siteInfo
}) => {
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 <BlogPostListEmpty currentSearch={currentSearch} />
} else {
return (
<div id='container' ref={targetRef} className='w-full'>
{/* 文章列表 */}
<div className='2xl:grid 2xl:grid-cols-2 grid-cols-1 gap-5'>
<div
className={`2xl:grid ${POST_TWO_COLS && '2xl:grid-cols-2'} grid-cols-1 gap-5`}>
{' '}
{postsToShow.map(post => (
<BlogPostCard
key={post.id}