fetch('/index.json') .then(response => response.json()) .then(data => { const fuse = new Fuse(data, { keys: ['title', 'contents', 'tags'], includeScore: true }); document.getElementById('search-input').addEventListener('input', function (e) { const results = fuse.search(e.target.value); displayResults(results); }); }); function displayResults(results) { const searchResults = document.getElementById('search-results'); searchResults.innerHTML = ''; if (results.length > 0) { searchResults.classList.remove("hidden"); } else { searchResults.classList.add("hidden"); } results.forEach(result => { const elem = document.createElement('div'); elem.innerHTML = `${result.item.title}