mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 23:16:51 +00:00
fix post?.
This commit is contained in:
@@ -96,7 +96,7 @@ export default function ArticleDetail(props) {
|
|||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{post.type === 'Post' && <ArticleAround prev={prev} next={next} /> }
|
{post?.type === 'Post' && <ArticleAround prev={prev} next={next} /> }
|
||||||
|
|
||||||
{/* 评论互动 */}
|
{/* 评论互动 */}
|
||||||
<div className="duration-200 shadow py-6 px-12 w-screen md:w-full overflow-x-auto dark:border-gray-700 bg-white dark:bg-hexo-black-gray">
|
<div className="duration-200 shadow py-6 px-12 w-screen md:w-full overflow-x-auto dark:border-gray-700 bg-white dark:bg-hexo-black-gray">
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ const LayoutSlug = props => {
|
|||||||
|
|
||||||
{/* 分享 */}
|
{/* 分享 */}
|
||||||
<ShareBar post={post} />
|
<ShareBar post={post} />
|
||||||
{post.type === 'Post' && <>
|
{post?.type === 'Post' && <>
|
||||||
<ArticleCopyright {...props} />
|
<ArticleCopyright {...props} />
|
||||||
<ArticleRecommend {...props} />
|
<ArticleRecommend {...props} />
|
||||||
<ArticleAdjacent {...props} />
|
<ArticleAdjacent {...props} />
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => {
|
|||||||
const searchKey = getSearchKey()
|
const searchKey = getSearchKey()
|
||||||
if (searchKey) {
|
if (searchKey) {
|
||||||
filteredPosts = posts.filter(post => {
|
filteredPosts = posts.filter(post => {
|
||||||
const tagContent = post.tags ? post.tags.join(' ') : ''
|
const tagContent = post?.tags ? post?.tags.join(' ') : ''
|
||||||
const searchContent = post.title + post.summary + tagContent
|
const searchContent = post.title + post.summary + tagContent
|
||||||
return searchContent.toLowerCase().includes(searchKey.toLowerCase())
|
return searchContent.toLowerCase().includes(searchKey.toLowerCase())
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ const LayoutSlug = props => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 上一篇下一篇文章 */}
|
{/* 上一篇下一篇文章 */}
|
||||||
{post.type === 'Post' && <ArticleAround prev={prev} next={next} />}
|
{post?.type === 'Post' && <ArticleAround prev={prev} next={next} />}
|
||||||
{/* 评论区 */}
|
{/* 评论区 */}
|
||||||
<Comment frontMatter={post} />
|
<Comment frontMatter={post} />
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ export default function ArticleDetail(props) {
|
|||||||
<ShareBar post={post} />
|
<ShareBar post={post} />
|
||||||
|
|
||||||
{/* 版权声明 */}
|
{/* 版权声明 */}
|
||||||
{post.type === 'Post' && <ArticleCopyright author={BLOG.AUTHOR} url={url} />}
|
{post?.type === 'Post' && <ArticleCopyright author={BLOG.AUTHOR} url={url} />}
|
||||||
|
|
||||||
{/* 推荐文章 */}
|
{/* 推荐文章 */}
|
||||||
{post.type === 'Post' && <RecommendPosts currentPost={post} recommendPosts={recommendPosts} />}
|
{post?.type === 'Post' && <RecommendPosts currentPost={post} recommendPosts={recommendPosts} />}
|
||||||
|
|
||||||
<section className="flex justify-between">
|
<section className="flex justify-between">
|
||||||
{/* 分类 */}
|
{/* 分类 */}
|
||||||
@@ -104,7 +104,7 @@ export default function ArticleDetail(props) {
|
|||||||
</>}
|
</>}
|
||||||
|
|
||||||
{/* 标签列表 */}
|
{/* 标签列表 */}
|
||||||
{post.type === 'Post' && (
|
{post?.type === 'Post' && (
|
||||||
<>
|
<>
|
||||||
{post.tagItems && (
|
{post.tagItems && (
|
||||||
<div className="flex flex-nowrap leading-8 p-1 py-4 overflow-x-auto">
|
<div className="flex flex-nowrap leading-8 p-1 py-4 overflow-x-auto">
|
||||||
@@ -119,7 +119,7 @@ export default function ArticleDetail(props) {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
{post.type === 'Post' && <BlogAround prev={prev} next={next} />}
|
{post?.type === 'Post' && <BlogAround prev={prev} next={next} />}
|
||||||
</>}
|
</>}
|
||||||
|
|
||||||
{/* 评论互动 */}
|
{/* 评论互动 */}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const ArticleInfo = (props) => {
|
|||||||
<div className="mr-2 mb-4 md:ml-0">
|
<div className="mr-2 mb-4 md:ml-0">
|
||||||
{post?.publishTime}
|
{post?.publishTime}
|
||||||
</div>
|
</div>
|
||||||
{post.tags && (
|
{post?.tags && (
|
||||||
<div className="flex flex-nowrap max-w-full overflow-x-auto article-tags">
|
<div className="flex flex-nowrap max-w-full overflow-x-auto article-tags">
|
||||||
{post?.tags.map(tag => (
|
{post?.tags.map(tag => (
|
||||||
<TagItem key={tag} tag={tag} />
|
<TagItem key={tag} tag={tag} />
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ const LayoutPostList = props => {
|
|||||||
let filteredBlogPosts = []
|
let filteredBlogPosts = []
|
||||||
if (filterKey && posts) {
|
if (filterKey && posts) {
|
||||||
filteredBlogPosts = posts.filter(post => {
|
filteredBlogPosts = posts.filter(post => {
|
||||||
const tagContent = post.tags ? post.tags.join(' ') : ''
|
const tagContent = post?.tags ? post?.tags.join(' ') : ''
|
||||||
const searchContent = post.title + post.summary + tagContent
|
const searchContent = post.title + post.summary + tagContent
|
||||||
return searchContent.toLowerCase().includes(filterKey.toLowerCase())
|
return searchContent.toLowerCase().includes(filterKey.toLowerCase())
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
import formatDate from '@/lib/formatDate'
|
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import BLOG from '@/blog.config'
|
import BLOG from '@/blog.config'
|
||||||
import TagItem from './TagItem'
|
import TagItem from './TagItem'
|
||||||
@@ -33,12 +32,9 @@ export const ArticleInfo = (props) => {
|
|||||||
<span className="block"> / </span>
|
<span className="block"> / </span>
|
||||||
</div>
|
</div>
|
||||||
<div className="mr-2 mb-4 md:ml-0">
|
<div className="mr-2 mb-4 md:ml-0">
|
||||||
{formatDate(
|
{post?.publishTime}
|
||||||
post?.publishTime || post?.createdTime,
|
|
||||||
BLOG.LANG
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
{post.tags && (
|
{post?.tags && (
|
||||||
<div className="flex flex-nowrap max-w-full overflow-x-auto article-tags">
|
<div className="flex flex-nowrap max-w-full overflow-x-auto article-tags">
|
||||||
{post?.tags.map(tag => (
|
{post?.tags.map(tag => (
|
||||||
<TagItem key={tag} tag={tag} />
|
<TagItem key={tag} tag={tag} />
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const ArticleInfo = (props) => {
|
|||||||
<span> <i className="fa-regular fa-user"></i> <a href={CONFIG.AUTHOR_LINK}>{BLOG.AUTHOR}</a></span>
|
<span> <i className="fa-regular fa-user"></i> <a href={CONFIG.AUTHOR_LINK}>{BLOG.AUTHOR}</a></span>
|
||||||
<span> - <i className="fa-regular fa-clock"></i> {post?.publishTime}</span>
|
<span> - <i className="fa-regular fa-clock"></i> {post?.publishTime}</span>
|
||||||
{post?.category && <span> - <i className="fa-regular fa-folder"></i> <a href={`/category/${post?.category}`} className="hover:text-red-400 transition-all duration-200">{post?.category}</a></span>}
|
{post?.category && <span> - <i className="fa-regular fa-folder"></i> <a href={`/category/${post?.category}`} className="hover:text-red-400 transition-all duration-200">{post?.category}</a></span>}
|
||||||
{post?.tags && post.tags?.length > 0 && post?.tags.map(t => <span key={t}> / <Link href={`/tag/${t}`}><span className=' hover:text-red-400 transition-all duration-200'>{t}</span></Link></span>)}
|
{post?.tags && post?.tags?.length > 0 && post?.tags.map(t => <span key={t}> / <Link href={`/tag/${t}`}><span className=' hover:text-red-400 transition-all duration-200'>{t}</span></Link></span>)}
|
||||||
</div>
|
</div>
|
||||||
</>)}
|
</>)}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const BlogItem = props => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
{post.category && <Link href={`/category/${post.category}`} className='p-1'> <span className="hover:text-red-400 transition-all duration-200"><i className="fa-regular fa-folder mr-0.5"/>{post.category}</span></Link>}
|
{post.category && <Link href={`/category/${post.category}`} className='p-1'> <span className="hover:text-red-400 transition-all duration-200"><i className="fa-regular fa-folder mr-0.5"/>{post.category}</span></Link>}
|
||||||
{post.tags && post.tags?.length > 0 && post.tags.map(t => <Link key={t} href={`/tag/${t}`} className=' hover:text-red-400 transition-all duration-200'><span > /{t}</span></Link>)}
|
{post?.tags && post?.tags?.length > 0 && post?.tags.map(t => <Link key={t} href={`/tag/${t}`} className=' hover:text-red-400 transition-all duration-200'><span > /{t}</span></Link>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user