From 3812567f1c3175bb8834e1f770c1a098dd86f5bc Mon Sep 17 00:00:00 2001
From: LinW_ <59436976+LinWhite2333@users.noreply.github.com>
Date: Tue, 19 Nov 2024 15:45:12 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=9C=89?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8tags=E7=94=9F=E6=88=90keywords=EF=BC=8C?=
=?UTF-8?q?=E6=96=87=E7=AB=A0=E6=90=9C=E7=B4=A2=E6=B2=A1=E6=9C=89=E7=94=9F?=
=?UTF-8?q?=E6=88=90tags=E5=92=8Ccategories=20(#540)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
layout/_partial/head.ejs | 2 +-
scripts/generators/search.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs
index 9885f60..0734c34 100755
--- a/layout/_partial/head.ejs
+++ b/layout/_partial/head.ejs
@@ -37,7 +37,7 @@ function generate_description() {
function generate_keywords() {
if (page.keywords && page.keywords.length > 0) {
return '';
- } else if (page.tags && Array.isArray(page.tags) && page.tags.length > 0) {
+ } else if (page.tags && page.tags.length > 0) {
return '';
} else if (config.keywords && config.keywords.length > 0) {
return '';
diff --git a/scripts/generators/search.js b/scripts/generators/search.js
index 930738b..218eb2e 100644
--- a/scripts/generators/search.js
+++ b/scripts/generators/search.js
@@ -43,14 +43,14 @@ hexo.extend.generator.register('search_json_generator', function (locals) {
content = content.replace(/[\s]{2,}/g, ' ')
temp_post.content = content.trim()
}
- if (post.tags && Array.isArray(post.tags) && post.tags.length > 0) {
+ if (post.tags && post.tags.length > 0) {
var tags = []
post.tags.forEach(function (tag) {
tags.push(tag.name)
})
temp_post.tags = tags
}
- if (post.categories && Array.isArray(post.categories) && post.categories.length > 0) {
+ if (post.categories && post.categories.length > 0) {
var categories = []
post.categories.forEach(function (cate) {
categories.push(cate.name)