Browse Source

update blog search

SyuanYu 2 years ago
parent
commit
6efed5f30d
1 changed files with 6 additions and 5 deletions
  1. 6 5
      layouts/blog/list.html

+ 6 - 5
layouts/blog/list.html

@@ -124,9 +124,10 @@
         let inputVal = $('#blog_search').val();
         matchContent = "";
         contentsData.map(item => {
-          // 搜尋特定分類的文章
-          if (item.categories) {
-            if (item.categories.includes(category)) {
+          // 搜尋特定分類文章
+          // if (item.categories) {
+          //   if (item.categories.includes(category)) {
+              // 搜尋所有分類文章
               if (item.title.includes(inputVal) || item.description.includes(inputVal) || item.content.includes(inputVal)) {
                 matchContent += `
                 <div class="article-item">
@@ -144,8 +145,8 @@
                   </div>
                 </div>`
               }
-            }
-          }
+          //   }
+          // }
         })
         document.getElementById("articleList").innerHTML = matchContent;
       });