Pagefindex - index your static site with Pagefind

Over the last several months, I’ve been using Tableau to rebuild my long-neglected website. Tableau is part of the Elixir Tools project headed by @mhanberg, and is built on top of MDEx by @leandrocp. This library is one of ten libraries and Elixir extensions that I built. Most of these were built with the assistance of Kiro.

Pagefindex is a wrapper for Pagefind for use with static sites written in Elixir and specific extension support for Tableau.

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.

With configuration similar to bun and esbuild, Pagefindex makes it easy to index a static site with a standalone Mix task.

mix pagefind # defaults to --site=_site --run-with=auto
mix pagefind --site=dist
mix pagefind --run-with=bun
mix pagefind --use-version=1.4.0

The real magic is for Tableau sites, as you can configure the Pagefindex.Tableau extension and it will automatically index your site after every mix tableau.build so that you have the Pagefind UI, library, and your site index available for every publish*.

config :tableau, Pagefindex.Tableau,
  enabled: true,
  run_with: :auto,
  debounce_ms: 2000

*Batteries Not Included

You still have to prepare your site for using Pagefind, but it’s pretty easy.

5 Likes

I have been using Pagefind with the Vite plugin of many static sites and it works great

Self-hosted site search without a third party are rare these days. Pagefind fills the gap perfectly.

Thanks for bringing Pagefindex to the Elixir world, and for the clear documentation with and without Tableau.
Have you tried custom rendering, filtering or are you using the default UI that Pagefind provides ?

1 Like

I’m using the default UI with a couple of tweaks (it pops up in its own search box on halostatue.ca when you hit /).

I’d consider doing more, but really what’s there suits my limited needs at the moment.

2 Likes