A couple of months ago I evaluated a few options for my small static website and pagefind came out on top. I’m quite happy with it. It’s client-side only (no server component), MIT-licensed, it’s mindful of users’ bandwidth and data usage and pretty quick (it runs webassembly).
Stork is the only other one that seemed very promising but unfortunately the only maintainer stepped down: https://stork-search.net
Does it give you a search URL? I couldn’t tell from the docs, so I’m hoping a user can tell me.
Lately I’ve run into search widgets where you can’t link to a search/results page — you have to first go to a page, then type into a box.
This hinders me because I make heavy use of custom searches, which need URLs like https://www.postgresql.org/search/?q=%s so I can search the Postgres docs by typing pg upsert into my address bar.
Stork is the only other one that seemed very promising but unfortunately the only maintainer stepped down
Are there any significant issues or missing features that made further development strongly desirable, or is there a potential that it will break without maintenance?
Web technology moves fast, and Stork uses wasm, so I assume it will eventually break without maintenance. Maybe it will take years, but since I had not committed to Stork yet and the maintainer himself suggested to look into alternatives, I did.
Looks like Pagefind isn’t available through Nix. It seems like the build product is (more or less) a single binary, so conceptually it should be easy enough to package with Nix, but some include_bytes calls during the build are failing to find the files they’re supposed to.
Is it prefix-only search? When I enter framewor in the default UI on pagefind.app, I get 1 result with framework word highlighted; however, when I enter ramework, I get “No results”. Also, can it do fuzzy-search? When I enter framywork, I don’t get the same result as for framewor.
The low-bandwidth attributes of Pagefind rely on sharding the search index by prefix, so in a search for ramework Pagefind will load the index chunk for something like ram*.
I have some ideas for slightly improving this area and adding some typo tolerance, but the goal of staying very low bandwidth somewhat precludes fuzzy searching, as the fuzzier you get the more of the index you need to load.
For example, using https://mdn.pagefind.app/ as a reference: Excluding Pagefind’s assets itself I can search for framework and load results in 80kB — but the total index for MDN is ~15MB, and to do a full fuzzy search you’d need to load most of that.
( For framywork it’s probably trimming it back to fram to find results. this case could and will be improved since in doing so it has likely loaded the shard of the index containing framework. )
A couple of months ago I evaluated a few options for my small static website and pagefind came out on top. I’m quite happy with it. It’s client-side only (no server component), MIT-licensed, it’s mindful of users’ bandwidth and data usage and pretty quick (it runs webassembly).
Stork is the only other one that seemed very promising but unfortunately the only maintainer stepped down: https://stork-search.net
Does it give you a search URL? I couldn’t tell from the docs, so I’m hoping a user can tell me.
Lately I’ve run into search widgets where you can’t link to a search/results page — you have to first go to a page, then type into a box.
This hinders me because I make heavy use of custom searches, which need URLs like
https://www.postgresql.org/search/?q=%s
so I can search the Postgres docs by typingpg upsert
into my address bar.As far as I see, it doesn’t do so out of the box, but it’s not very hard to build it: https://kiko.io/post/Pagefind-UI-and-URL-Parameters/
I can confirm, no search URL out of the box (the search bar provides links to the canonical URLs of the site pages)
Are there any significant issues or missing features that made further development strongly desirable, or is there a potential that it will break without maintenance?
Web technology moves fast, and Stork uses wasm, so I assume it will eventually break without maintenance. Maybe it will take years, but since I had not committed to Stork yet and the maintainer himself suggested to look into alternatives, I did.
Browser APIs certainly don’t move fast — JS libraries from decades ago still work without any modifications.
Happy user of pagefind for my static site! Wrote about it some time ago: https://raymii.org/s/blog/Site_update_self_hosted_search_via_pagefind.html
This is great for me because I’m working on a static site that needs search this week. :-)
If you’re interested, I’d love to get your feedback on a service I created recently: https://pgs.sh
I am using Pagefind for https://dotat.at/search.html (my crufty static site generator is also written in Rust)
Looks like Pagefind isn’t available through Nix. It seems like the build product is (more or less) a single binary, so conceptually it should be easy enough to package with Nix, but some
include_bytes
calls during the build are failing to find the files they’re supposed to.https://github.com/NixOS/nixpkgs/pull/247773
Ooh, thank you!
Is it prefix-only search? When I enter
framewor
in the default UI on pagefind.app, I get 1 result withframework
word highlighted; however, when I enterramework
, I get “No results”. Also, can it do fuzzy-search? When I enterframywork
, I don’t get the same result as forframewor
.Currently prefix-based, yes.
The low-bandwidth attributes of Pagefind rely on sharding the search index by prefix, so in a search for
ramework
Pagefind will load the index chunk for something likeram*
.I have some ideas for slightly improving this area and adding some typo tolerance, but the goal of staying very low bandwidth somewhat precludes fuzzy searching, as the fuzzier you get the more of the index you need to load.
For example, using https://mdn.pagefind.app/ as a reference: Excluding Pagefind’s assets itself I can search for
framework
and load results in 80kB — but the total index for MDN is ~15MB, and to do a full fuzzy search you’d need to load most of that.( For
framywork
it’s probably trimming it back tofram
to find results. this case could and will be improved since in doing so it has likely loaded the shard of the index containingframework
. )V1.0.1 hotfix release just happened https://github.com/CloudCannon/pagefind/releases/tag/v1.0.1
No good release goes untarnished 🫣
That one was on me. I’m packaging it in nixpkgs and they used a git dependency in cargo, which nixpkgs does not like that well…
I just tried this on my static site and it feels like magic. Beautiful.
Wow looks awesome! Having a static file architecture is huge for static sites!
I definitely want to try this