Closed valencik closed 8 months ago
I've updated the issue title and description to better capture where this work brings us. I don't necessarily think this is the final plugin that users will end up installing to add search to their site. But it sure makes testing protosearch on real sites easy.
I'm going to merge this work as completed but leave https://github.com/cozydev-pink/protosearch/issues/102 open to track continuing efforts.
This PR adds a sbt plugin, "protosearch-sbt", for generating an index of site documentation.
When the protosearch-sbt plugin is included in an sbt build, any
LaikaPlugin
enabled projects, will have theProtosearchPlugin
enabled as well. TheProtosearchPlugin
introduces a task,protosearchGenerateIndex
that will render documents using theIndexFormat
introduced in https://github.com/cozydev-pink/protosearch/pull/140. Additionally this task is triggered by thelaikaSite
task, so index creation will happen, by default, when the site is built.This addresses a big part of https://github.com/cozydev-pink/protosearch/issues/102, namely:
The index, along with a few supporting html and js files are added to a
search
directory in the site output directory.Up Next
Currently the UX of the search page is very limited, not even returning the titles of documents match! Future work in https://github.com/cozydev-pink/protosearch/issues/154 will add support for storing fields in the index which will enable us to make this search experience much better.
The plugin structure and configuration could be totally revisited. This is very much a prototype to get things working. Ultimately generating an index should probably feel a lot like generating an ePub or PDF for a Laika site, and be similarly configurable.
Lastly, the
IndexFormat
andTwoPhaseRenderFormat
are still rather experimental and expected to change over time. It would be nice to take advantage of more structure in the Laika ASTs than just the "plaintext".