From a00241040d7e42d1b982659a0cb04203747fc064 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 13 Apr 2022 14:25:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E6=96=87=E7=B4=A2=E5=BC=95=E5=BE=AE?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/[keyword].js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index 706ae7ae..12ab9dda 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -2,14 +2,14 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import { useGlobal } from '@/lib/global' import { getDataFromCache } from '@/lib/cache/cache_manager' import * as ThemeMap from '@/themes' +import BLOG from '@/blog.config' const Index = props => { const { keyword, siteInfo } = props const { locale } = useGlobal() const meta = { - title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteInfo.title - }`, - description: siteInfo.title, + title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteInfo?.title}`, + description: siteInfo?.title, slug: 'search/' + (keyword || ''), type: 'website' } @@ -29,7 +29,7 @@ const Index = props => { * @param {*} param0 * @returns */ -export async function getServerSideProps({ params: { keyword } }) { +export async function getStaticProps({ params: { keyword } }) { const props = await getGlobalNotionData({ from: 'search-props', pageType: ['Post'] @@ -41,6 +41,13 @@ export async function getServerSideProps({ params: { keyword } }) { } } +export async function getStaticPaths() { + return { + paths: [{ params: { keyword: BLOG.TITLE } }], + fallback: true + } +} + /** * 将对象的指定字段拼接到字符串 * @param sourceTextArray