Pagefind
I added static search to this site in less than half an hour using Pagefind.
Pagefind is a fully static search library that aims to perform well on large sites, while using as little of your users’ bandwidth as possible, and without hosting any infrastructure.
The only thing I did was adding this snippet to my startpage:
<link href = "/pagefind/pagefind-ui.css" rel = "stylesheet">
<script src = "/pagefind/pagefind-ui.js"></script>
<div id = "search"></div>
<script>
window.addEventListener('DOMContentLoaded', (event) = > {
new PagefindUI({ element: "#search", showSubResults: true });
});
</script>
And run pagefind on my built website files:
uv run --with pagefind[extended] python -m pagefind --site site/
Pretty neat!