From 8d6e6937c5abee99929c51733ac65a24d6878c35 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 14 Apr 2022 17:51:59 +0800 Subject: [PATCH] =?UTF-8?q?build=E8=A1=A5=E4=B8=81=20-=20=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/[keyword].js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index 74591872..1607cb90 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -107,8 +107,8 @@ async function filterByMemCache(allPosts, keyword) { for (const post of allPosts) { const cacheKey = 'page_block_' + post.id const page = await getDataFromCache(cacheKey) - const tagContent = post.tags ? post.tags.join(' ') : '' - const categoryContent = post.category ? post.category.join(' ') : '' + const tagContent = post.tags && Array.isArray(post.tags) ? post.tags.join(' ') : '' + const categoryContent = post.category && Array.isArray(post.category) ? post.category.join(' ') : '' const articleInfo = post.title + post.summary + tagContent + categoryContent let hit = articleInfo.indexOf(keyword) > -1 let indexContent = [post.summary]