Next主题可隐藏头图,并显示icon

This commit is contained in:
tangly
2022-11-18 11:44:12 +08:00
parent 12babbdbca
commit b4398e516e
5 changed files with 38 additions and 3 deletions

View File

@@ -11,6 +11,8 @@ import { useRouter } from 'next/router'
import ArticleCopyright from './ArticleCopyright'
import WordCount from './WordCount'
import NotionPage from '@/components/NotionPage'
import CONFIG_NEXT from '../config_next'
import NotionIcon from '@/components/NotionIcon'
/**
*
@@ -29,7 +31,7 @@ export default function ArticleDetail(props) {
>
{showArticleInfo && <header className='animate__slideInDown animate__animated'>
{post?.type && !post?.type.includes('Page') && post?.page_cover && (
{CONFIG_NEXT.POST_HEADER_IMAGE_VISIBLE && post?.type && !post?.type !== 'Page' && post?.page_cover && (
<div className="w-full relative md:flex-shrink-0 overflow-hidden">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img alt={post.title} src={post?.page_cover} className='object-center w-full' />
@@ -38,7 +40,7 @@ export default function ArticleDetail(props) {
{/* 文章Title */}
<div className="font-bold text-3xl text-black dark:text-white font-serif pt-10">
{post.title}
<NotionIcon icon={post.pageIcon}/>{post.title}
</div>
<section className="flex-wrap flex mt-2 text-gray-400 dark:text-gray-400 font-light leading-8">

View File

@@ -7,6 +7,7 @@ import Card from './Card'
import TagItemMini from './TagItemMini'
import CONFIG_NEXT from '../config_next'
import NotionPage from '@/components/NotionPage'
import NotionIcon from '@/components/NotionIcon'
const BlogPostCard = ({ post, showSummary }) => {
const { locale } = useGlobal()
@@ -23,7 +24,7 @@ const BlogPostCard = ({ post, showSummary }) => {
className={`cursor-pointer hover:underline text-3xl ${showPreview ? 'text-center' : ''
} leading-tight text-gray-700 dark:text-gray-100 hover:text-blue-500 dark:hover:text-blue-400`}
>
{post.title}
<NotionIcon icon={post.pageIcon} /> {post.title}
</a>
</Link>

View File

@@ -9,6 +9,8 @@ const CONFIG_NEXT = {
POST_LIST_PREVIEW: true, // 显示文章预览
POST_LIST_SUMMARY: false, // 显示用户自定义摘要,有预览时优先只展示预览
POST_HEADER_IMAGE_VISIBLE: false, // 文章详情页是否显示封面图
// 右侧组件
RIGHT_BAR: true, // 是否显示右侧栏
RIGHT_LATEST_POSTS: true, // 右侧栏最新文章