Skip to content

Add support for HTML site search #493

@armanbilge

Description

@armanbilge

The topic of search came up briefly in #360 (comment) and I'd like to spin it into a proper feature request.

@valencik and @samspills have been working hard on protosearch and friends which is a pure Scala search library. There are some demos, such as this http4s docs search embedded in an HTML page using a JS-exported API.

I've only been following along in awe, I'm not deeply versed in how it's all working unfortunately 😅

The high-level idea of protosearch is to:

  1. support indexing on the JVM
  2. support querying in the browser via JS (or one day WASM)

For Laika integration + deployment, one idea we've had is the following:

  1. Indexing is implemented as a Laika renderer that produces an index artifact. This can be deployed as part of the site (similar to how e.g. epub / pdfs are included in the site).

  2. protosearch publishes a JS library to NPM and is available via CDNs. This JS library can load an index file and run queries on it.

  3. A search page is added to the site which uses a small bit of JS to glue together a search bar, the protosearch.js library, and index file.

This doesn't necessarily have to be something in the Laika core repository and there may be good reasons it shouldn't be. But it could exist as a separate project/plugin that is brought in by sbt-typelevel-site.

Discuss! 😇

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions