From f1724dbe1aa9ec24b18b45f5df04270169feb515 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 14 Dec 2021 12:06:27 +0800 Subject: [PATCH] =?UTF-8?q?dev:=20=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/RecommendPosts.js | 2 +- layouts/BaseLayout.js | 2 +- lib/cache/local_file_cache.js | 1 - lib/notion/getAllPageIds.js | 3 +++ pages/tag/[tag].js | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/RecommendPosts.js b/components/RecommendPosts.js index abca15a2..b20bd754 100644 --- a/components/RecommendPosts.js +++ b/components/RecommendPosts.js @@ -42,7 +42,7 @@ const RecommendPosts = ({ currentPost, totalPosts }) => { const { locale } = useGlobal() return ( -
+
{locale.COMMON.RELATE_POSTS}
    {filteredPosts.map(post => ( diff --git a/layouts/BaseLayout.js b/layouts/BaseLayout.js index 80eb38e7..4555f435 100644 --- a/layouts/BaseLayout.js +++ b/layouts/BaseLayout.js @@ -80,7 +80,7 @@ const BaseLayout = ({
    {onLoading ? - :
    + :
    {children}
    } diff --git a/lib/cache/local_file_cache.js b/lib/cache/local_file_cache.js index 386eb28d..482b7bb5 100644 --- a/lib/cache/local_file_cache.js +++ b/lib/cache/local_file_cache.js @@ -1,5 +1,4 @@ import fs from 'fs' -import BLOG from '@/blog.config' const path = require('path') // 文件缓存持续10秒 diff --git a/lib/notion/getAllPageIds.js b/lib/notion/getAllPageIds.js index 7673889c..6821925e 100644 --- a/lib/notion/getAllPageIds.js +++ b/lib/notion/getAllPageIds.js @@ -1,6 +1,9 @@ import { idToUuid } from 'notion-utils' export default function getAllPageIds (collectionQuery, viewId) { + if (!collectionQuery) { + return [] + } const views = Object.values(collectionQuery)[0] if (!views) { return [] diff --git a/pages/tag/[tag].js b/pages/tag/[tag].js index 2e607fa0..18f5a55d 100644 --- a/pages/tag/[tag].js +++ b/pages/tag/[tag].js @@ -29,7 +29,7 @@ export async function getStaticProps ({ params }) { const allPosts = await getAllPosts({ notionPageData, from }) const categories = await getAllCategories(allPosts) const tagOptions = notionPageData.tagOptions - const tags = await getAllTags({ allPosts, tagOptions }) + const tags = await getAllTags({ allPosts, tagOptions, sliceCount: 0 }) const filteredPosts = allPosts.filter( post => post && post.tags && post.tags.includes(currentTag) )