{{ define "main" }}
<body><noscript><divstyle="color: red;">Please enable JavaScript to use the search functionality.</div></noscript><divid="loading"style="display: block;">Loading...</div><divid="search-container"style="display: none;"><inputtype="text"id="search-input"placeholder="Search..."><ulid="search-results"></ul></div><scriptsrc="/js/search/fuse.js"></script><script>document.addEventListener('DOMContentLoaded',function(){constloadingElement=document.getElementById('loading');constsearchContainer=document.getElementById('search-container');constsearchInput=document.getElementById('search-input');constsearchResults=document.getElementById('search-results');fetch('/index.json').then(response=>response.json()).then(data=>{loadingElement.style.display='none';// Hide loading indicator
searchContainer.style.display='block';// Show search container
constoptions={keys:['title','tags','categories','contents']};constfuse=newFuse(data,options);constperformSearch=()=>{constquery=searchInput.value;constresults=fuse.search(query);searchResults.innerHTML='';results.forEach(result=>{constitem=result.item;constli=document.createElement('li');consta=document.createElement('a');a.href=item.permalink;a.textContent=item.title;li.appendChild(a);searchResults.appendChild(li);});};searchInput.addEventListener('input',performSearch);// Perform initial search if there's already a value in the search input
if(searchInput.value){performSearch();}}).catch(error=>{loadingElement.style.display='none';// Hide loading indicator
console.error('Error loading index.json:',error);});});</script></body>{{ end }}