.
This commit is contained in:
parent
2a9167cb7e
commit
96573664a6
95 changed files with 4130 additions and 2328 deletions
|
|
@ -17,17 +17,18 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
const query = searchInput.value.trim().toLowerCase();
|
||||
resultsList.innerHTML = "";
|
||||
|
||||
if (!query) return;
|
||||
if (!query) {
|
||||
return;
|
||||
}
|
||||
|
||||
// filter out posts that don't match
|
||||
const matches = index.filter(
|
||||
(post) =>
|
||||
post.title.toLowerCase().includes(query) ||
|
||||
post.content.toLowerCase().includes(query),
|
||||
);
|
||||
|
||||
if (matches.length === 0) {
|
||||
resultsList.innerHTML = "<li>No results found.</li>";
|
||||
resultsList.innerHTML = "<li>You leafed too hard :/</li>";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue