Skip to content

Commit 8d8f2bd

Browse files
committed
2 parents c8f5e0a + bddc400 commit 8d8f2bd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

themes/nobelium/components/BlogPost.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import Link from 'next/link'
22
import { siteConfig } from '@/lib/config'
33
import { checkContainHttp, sliceUrlFromHttp } from '@/lib/utils'
44
import NotionIcon from '@/components/NotionIcon'
5+
import NotionPage from '@/components/NotionPage'
56

67
const BlogPost = ({ post }) => {
78
const url = checkContainHttp(post.slug) ? sliceUrlFromHttp(post.slug) : `${siteConfig('SUB_PATH', '')}/${post.slug}`
89

10+
const showPreview = siteConfig('POST_LIST_PREVIEW') && post.blockMap
11+
912
return (
1013
(<Link href={url}>
1114

@@ -19,9 +22,15 @@ const BlogPost = ({ post }) => {
1922
</time>
2023
</header>
2124
<main>
22-
<p className="hidden md:block leading-8 text-gray-700 dark:text-gray-300">
25+
{!showPreview && <p className="hidden md:block leading-8 text-gray-700 dark:text-gray-300">
2326
{post.summary}
24-
</p>
27+
</p>}
28+
{showPreview && post?.blockMap && (
29+
<div className="overflow-ellipsis truncate">
30+
<NotionPage post={post} />
31+
<hr className='border-dashed py-4'/>
32+
</div>
33+
)}
2534
</main>
2635
</article>
2736

0 commit comments

Comments
 (0)