From 69abbd8e3ed494a1dbe0397f746891c6246c0624 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 11 Jan 2022 10:25:29 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BD=93=E7=A7=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/about.js | 8 ++++---- pages/article/[slug].js | 3 --- pages/search.js | 2 +- pages/tag/index.js | 7 +++---- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pages/about.js b/pages/about.js index 28a93342..0ccfeae3 100644 --- a/pages/about.js +++ b/pages/about.js @@ -21,7 +21,7 @@ import React from 'react' * @param {*} param0 * @returns */ -const About = ({ post, blockMap, tags, prev, next, allPosts, categories }) => { +const About = ({ post, blockMap, tags, prev, next, postCount, categories }) => { if (!post) { return } @@ -39,10 +39,10 @@ const About = ({ post, blockMap, tags, prev, next, allPosts, categories }) => { meta={meta} tags={tags} post={post} - totalPosts={allPosts} + postCount={postCount} categories={categories} > - + ) } @@ -69,7 +69,7 @@ export async function getStaticProps () { const next = allPosts.slice(index + 1, index + 2)[0] ?? allPosts[0] return { - props: { post, blockMap, tags, prev, next, allPosts, categories, postCount, latestPosts }, + props: { post, blockMap, tags, prev, next, categories, postCount, latestPosts }, revalidate: 1 } } diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 8f055522..0a5c4bbb 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -16,7 +16,6 @@ const Slug = ({ tags, prev, next, - allPosts, recommendPosts, categories, postCount, @@ -39,7 +38,6 @@ const Slug = ({ post={post} postCount={postCount} latestPosts={latestPosts} - totalPosts={allPosts} categories={categories} > { +const Search = ({ posts, tags, categories, postCount }) => { let filteredPosts = [] const searchKey = getSearchKey() if (searchKey) { diff --git a/pages/tag/index.js b/pages/tag/index.js index 54405469..6977f37d 100644 --- a/pages/tag/index.js +++ b/pages/tag/index.js @@ -7,14 +7,14 @@ import { faTags } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import React from 'react' -export default function Tag ({ tags, allPosts, categories, postCount, latestPosts }) { +export default function Tag ({ tags, categories, postCount, latestPosts }) { const { locale } = useGlobal() const meta = { title: `${locale.COMMON.TAGS} | ${BLOG.title}`, description: BLOG.description, type: 'website' } - return + return
{locale.COMMON.TAGS}:
@@ -28,12 +28,11 @@ export default function Tag ({ tags, allPosts, categories, postCount, latestPost export async function getStaticProps () { const from = 'tag-index-props' - const { allPosts, categories, tags, postCount, latestPosts } = await getGlobalNotionData({ from, includePage: true, tagsCount: 0 }) + const { categories, tags, postCount, latestPosts } = await getGlobalNotionData({ from, includePage: true, tagsCount: 0 }) return { props: { tags, - posts: allPosts, categories, postCount, latestPosts