允许封面图为空

This commit is contained in:
tangly1024.com
2023-02-03 13:09:37 +08:00
parent a947be01e5
commit d93f08fe11
9 changed files with 42 additions and 34 deletions

View File

@@ -4,8 +4,13 @@ import React from 'react'
import TagItemMini from './TagItemMini'
import CONFIG_MATERY from '../config_matery'
const BlogPostCard = ({ post, showSummary }) => {
const BlogPostCard = ({ post, showSummary, siteInfo }) => {
const showPreview = CONFIG_MATERY.POST_LIST_PREVIEW && post.blockMap
// matery 主题默认强制显示图片
if (post && !post.page_cover) {
post.page_cover = siteInfo.pageCover
}
const showPageCover = CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover
return (
<div
data-aos="zoom-in"
@@ -19,7 +24,7 @@ const BlogPostCard = ({ post, showSummary }) => {
<div key={post.id} className="flex flex-col h-96 justify-between">
{/* 头部图片 填充卡片 */}
{CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover && (
{showPageCover && (
<Link href={`${BLOG.SUB_PATH}/${post.slug}`} passHref legacyBehavior>
<div className="flex flex-grow w-full relative duration-200 bg-black rounded-t-md cursor-pointer transform overflow-hidden">
{/* eslint-disable-next-line @next/next/no-img-element */}