Pagefind

I have developed and written about my own static site search library for Astro. It was fun and instructive. I learned more about search, Astro’s inner workings, and practiced publishing an NPM package.

I wanted to provide something as easy to configure and use as the original VuePress static search. It should be possible to whip up a markdown-driven static site with a decent search without begging Algolia for help. The problems I faced with this solution were:

I found an integration with a new library called Pagefind through the Astro integrations library. In many ways it is technically superior. It indexes the static output HTML after the build, so works with any SSG, not just Astro. There’s a default UI that works Just Fine after a little CSS tweaking. You can easily customize how content is indexed. Unlike my library, it actually displays highlighted content excerpts. There’s a lot to like, and I appreciate CloudCannon’s work on this.

My main complaint is that it does not split documents by heading. I have some long-ish documents and the search only helps you know the query is somewhere in the page. However, this feature appears to be on the roadmap, so I’ll keep an eye out.

Will I continue to maintain my own astro-minisearch library? Time will tell. For now, I recommend you try out Pagefind and see if it works for you.

Support