1. 60

    1. 10

      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

      1. 4

        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.

        1. 6

          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/

          1. 2

            I can confirm, no search URL out of the box (the search bar provides links to the canonical URLs of the site pages)

      2. 2

        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?

        1. 1

          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.

          1. 2

            Browser APIs certainly don’t move fast — JS libraries from decades ago still work without any modifications.

    2. 6

      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

    3. 3

      This is great for me because I’m working on a static site that needs search this week. :-)

      1. 1

        If you’re interested, I’d love to get your feedback on a service I created recently: https://pgs.sh

    4. 3

      I am using Pagefind for https://dotat.at/search.html (my crufty static site generator is also written in Rust)

    5. 2

      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.

        1. 2

          Ooh, thank you!

    6. 2

      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.

      1. 6

        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 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. )

    7. 2
      1. 3

        No good release goes untarnished 🫣

      2. 2

        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…

    8. 2

      I just tried this on my static site and it feels like magic. Beautiful.

    9. 1

      Wow looks awesome! Having a static file architecture is huge for static sites!

      I definitely want to try this