From 89af6aba7816a0a092665a1be72fc7bb823208f8 Mon Sep 17 00:00:00 2001 From: tangly Date: Sun, 5 Dec 2021 12:47:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=96=87=E7=AB=A0=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=B7=B3=E8=BD=AC=E8=87=B3=E5=BD=92=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/BlogPostArchive.js | 8 +++----- components/MenuButtonGroup.js | 2 +- pages/archive/index.js | 2 +- pages/article/[slug].js | 11 ++++------- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/components/BlogPostArchive.js b/components/BlogPostArchive.js index 646c9c29..be661f9b 100644 --- a/components/BlogPostArchive.js +++ b/components/BlogPostArchive.js @@ -13,19 +13,17 @@ const BlogPostArchive = ({ posts = [], archiveTitle }) => { if (!posts || posts.length === 0) { return <> } else { - return
-
{archiveTitle}
- {/* 文章列表 */} + return
+
{archiveTitle}
    {posts.map(post => (
  • - {post.date.start_date}   {post.title} +
    {post.date.start_date}   {post.title}
  • ))}
-
} } diff --git a/components/MenuButtonGroup.js b/components/MenuButtonGroup.js index 857b2779..34021131 100644 --- a/components/MenuButtonGroup.js +++ b/components/MenuButtonGroup.js @@ -25,7 +25,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {
{links.map(link => { if (link.show) { - const selected = router.asPath === link.to + const selected = router.pathname === link.to return diff --git a/pages/archive/index.js b/pages/archive/index.js index 6aae96e1..57e2bcb9 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -59,7 +59,7 @@ const Index = ({ allPosts, tags, categories }) => {
-
{locale.NAV.ARCHIVE}
+
{locale.NAV.ARCHIVE}
{Object.keys(archivePosts).map(archiveTitle => ( diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 875f76ba..3e7a65dc 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -6,7 +6,6 @@ import Progress from '@/components/Progress' import TagItem from '@/components/TagItem' import formatDate from '@/lib/formatDate' import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' -import RewardButton from '@/components/RewardButton' import ShareBar from '@/components/ShareBar' import Comment from '@/components/Comment' import BaseLayout from '@/layouts/BaseLayout' @@ -47,6 +46,7 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories const drawerRight = useRef(null) const url = BLOG.link + useRouter().asPath const { locale } = useGlobal() + const date = formatDate(post?.date?.start_date || post.createdTime, BLOG.lang) return @@ -56,7 +56,7 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
{post.type && !post.type.includes('Page') && (<>
- 1) ? post.page_cover : BLOG.defaultImgCover} loading='lazy' objectFit='cover' layout='fill' alt={post.title} /> + 1) ? post.page_cover : BLOG.defaultImgCover} loading='eager' objectFit='cover' layout='fill' alt={post.title} />
)} @@ -71,12 +71,9 @@ const ArticleDetail = ({ post, blockMap, tags, prev, next, allPosts, categories
{post.type[0] !== 'Page' && ( - +
- {formatDate( - post?.date?.start_date || post.createdTime, - BLOG.lang - )} + {date}
)}