From 197c2b6c7bce77a8c2e75e6e76bdea4c8061eda6 Mon Sep 17 00:00:00 2001 From: kazoottt <31075337+KazooTTT@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:31:19 +0800 Subject: [PATCH 1/2] fix: algolia'slastEditedDate should be post's --- lib/algolia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/algolia.js b/lib/algolia.js index d2d9cb37..fe2f9a83 100644 --- a/lib/algolia.js +++ b/lib/algolia.js @@ -42,7 +42,7 @@ const uploadDataToAlgolia = async(post) => { if (!existed || !existed?.lastEditedDate || !existed?.lastIndexDate) { needUpdateIndex = true } else { - const lastEditedDate = new Date(existed.lastEditedDate) + const lastEditedDate = new Date(post.lastEditedDate) const lastIndexDate = new Date(existed.lastIndexDate) if (lastEditedDate.getTime() > lastIndexDate.getTime()) { needUpdateIndex = true From 03da8478fae1935a66af73b0ac7ae1e20344ece8 Mon Sep 17 00:00:00 2001 From: kazoottt <31075337+KazooTTT@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:33:45 +0800 Subject: [PATCH 2/2] fix: set SUB_PATH default value to '' if not , the href will be `undefined/xxx` --- components/AlgoliaSearchModal.js | 103 ++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 36 deletions(-) diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js index fe672e44..7c6bfdcb 100644 --- a/components/AlgoliaSearchModal.js +++ b/components/AlgoliaSearchModal.js @@ -102,43 +102,74 @@ export default function AlgoliaSearchModal({ cRef }) { } return ( -
- - {/* 模态框 */} -
- -
-
搜索
-
-
- - handleInputChange(e)} - className="text-black dark:text-gray-200 bg-gray-50 dark:bg-gray-600 outline-blue-500 w-full px-4 my-2 py-1 mb-4 border rounded-md" /> - - {/* 标签组 */} -
- -
- - - - -
{totalHit > 0 &&
共搜索到 {totalHit} 条结果,用时 {useTime} 毫秒
}
-
Algolia 提供搜索服务
-
- - {/* 遮罩 */} -
- +
+ {/* 模态框 */} +
+
+
搜索
+
+ +
+ + handleInputChange(e)} + className="text-black dark:text-gray-200 bg-gray-50 dark:bg-gray-600 outline-blue-500 w-full px-4 my-2 py-1 mb-4 border rounded-md" + /> + + {/* 标签组 */} +
+ +
+ + + + +
+ {totalHit > 0 && ( +
+ 共搜索到 {totalHit} 条结果,用时 {useTime} 毫秒 +
+ )} +
+
+ + Algolia 提供搜索服务 + {' '} +
+
+ + {/* 遮罩 */} +
+
) }