修复404跳转bug

This commit is contained in:
tangly1024
2022-04-13 13:05:20 +08:00
parent b122bab41d
commit f1a29575bd
14 changed files with 78 additions and 37 deletions

View File

@@ -21,7 +21,7 @@ export default function ArticleDetail(props) {
const { post, recommendPosts, prev, next, showArticleInfo } = props
const url = BLOG.LINK + useRouter().asPath
const { locale } = useGlobal()
const date = formatDate(post?.date?.start_date || post.createdTime, locale.LOCALE)
const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE)
return (<div id="container" className="shadow md:hover:shadow-2xl overflow-x-auto flex-grow mx-auto w-screen md:w-full ">
<div itemScope itemType="https://schema.org/Movie"
@@ -29,7 +29,7 @@ export default function ArticleDetail(props) {
>
{showArticleInfo && <header className='animate__slideInDown animate__animated'>
{post.type && !post.type.includes('Page') && post?.page_cover && (
{post?.type && !post?.type.includes('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' />
@@ -51,7 +51,7 @@ export default function ArticleDetail(props) {
</Link>
<span className='mr-2'>|</span>
</>}
{post.type[0] !== 'Page' && (<>
{post?.type[0] !== 'Page' && (<>
<Link
href={`/archive#${post?.date?.start_date?.substr(0, 7)}`}
passHref
@@ -84,7 +84,7 @@ export default function ArticleDetail(props) {
{/* Notion内容主体 */}
<article id='notion-article' className='px-1'>
{post.blockMap && (<NotionPage post={post} />)}
{post && (<NotionPage post={post} />)}
</article>
<section className="px-1 py-2 my-1 text-sm font-light overflow-auto text-gray-600 dark:text-gray-400">