Include page body in search

This commit is contained in:
thePR0M3TH3AN
2025-07-10 16:09:03 -04:00
parent b08eff24e0
commit 1a67388f85
3 changed files with 8 additions and 2 deletions

View File

@@ -65,7 +65,8 @@ document.addEventListener('DOMContentLoaded', () => {
if (!doc) return;
const a = document.createElement('a');
a.href = doc.url;
a.innerHTML = '<strong>' + highlight(doc.title, q) + '</strong><br><small>' + highlight(doc.headings, q) + '</small>';
const snippet = doc.body ? doc.body.slice(0, 160) + (doc.body.length > 160 ? '...' : '') : '';
a.innerHTML = '<strong>' + highlight(doc.title, q) + '</strong><br><small>' + highlight(snippet, q) + '</small>';
searchResults.appendChild(a);
});
searchResults.style.display = 'block';