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 } 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) 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}
}