From 3d2ebb5b9416f056d6235f0b478d1151c73e8edb Mon Sep 17 00:00:00 2001 From: tangly Date: Tue, 8 Nov 2022 12:37:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?next=E6=96=87=E5=AD=97=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/components/InfoCard.js | 2 +- themes/next/components/Logo.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/next/components/InfoCard.js b/themes/next/components/InfoCard.js index 6ddde9c4..5bbed271 100644 --- a/themes/next/components/InfoCard.js +++ b/themes/next/components/InfoCard.js @@ -12,7 +12,7 @@ const InfoCard = (props) => {
{BLOG.AUTHOR}
-
{BLOG.BIO}
+
{BLOG.BIO}
diff --git a/themes/next/components/Logo.js b/themes/next/components/Logo.js index 8169b624..46cb814e 100644 --- a/themes/next/components/Logo.js +++ b/themes/next/components/Logo.js @@ -6,7 +6,7 @@ const Logo = props => { return
{siteInfo?.title}
-
{siteInfo?.description}
+
{siteInfo?.description}
} From 8b5ecdb35f6c786b0ce8f1d94a786937cdba0025 Mon Sep 17 00:00:00 2001 From: tangly Date: Tue, 8 Nov 2022 12:47:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9C=80=E6=96=B0=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index c74552cb..bcd2df5e 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -42,7 +42,7 @@ export async function getGlobalNotionData({ * @returns */ function getLatestPosts({ allPages, from, latestPostCount }) { - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') const latestPosts = Object.create(allPosts).sort((a, b) => { const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date) From a27413df1042848df4dc6fef42afd0d9088168ca Mon Sep 17 00:00:00 2001 From: tangly Date: Tue, 8 Nov 2022 13:00:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=BB=E9=A2=98,?= =?UTF-8?q?=E6=9B=B4=E6=96=B0busuanzi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Busuanzi.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/Busuanzi.js b/components/Busuanzi.js index a2456a75..12e592d8 100644 --- a/components/Busuanzi.js +++ b/components/Busuanzi.js @@ -1,10 +1,15 @@ import busuanzi from '@/lib/busuanzi' import { useRouter } from 'next/router' -import { useEffect } from 'react' +import { useGlobal } from '@/lib/global' +// import { useRouter } from 'next/router' +import React from 'react' export default function Busuanzi () { + const { theme } = useGlobal() const router = useRouter() - useEffect(() => { + + // 切换文章时更新 + React.useEffect(() => { const busuanziRouteChange = url => { busuanzi.fetch() } @@ -13,5 +18,12 @@ export default function Busuanzi () { router.events.off('routeChangeComplete', busuanziRouteChange) } }, [router.events]) + + // 更换主题时更新 + React.useEffect(() => { + if (theme) { + busuanzi.fetch() + } + }) return null }