Conversation
| val indexConfig = | ||
| IndexConfig.withExcludedPaths(Path.Root / "404.md") |
There was a problem hiding this comment.
I think this part is neat, we can define the config and settings once and then access the BinaryRendererConfig with indexConfig.config and the TwoPhaseRenderFormat for Transformers with indexConfig.format.
|
|
||
| function renderHit(hit) { | ||
| const link = `${hit.fields.path}.html` | ||
| const link = `/${hit.fields.path}.html` |
There was a problem hiding this comment.
Because the path field no longer has the leading slash.
Which means queries like path:blog now work
| tree.addString(mkRedirect(to), Root / (from.stripSuffix(".html") + ".md")) | ||
| } | ||
|
|
||
| def paths = map.keys.map(p => Root / p.stripSuffix(".html")).toList |
armanbilge
left a comment
There was a problem hiding this comment.
This is great! But I wonder if it could be better UX to indicate in the config of a page itself (or a directory) whether it should be indexed or not?
I agree it should be possible to leverage HOCON config to exclude from the index. That would probably be nice for excluding the 404 page. However, I don't think that would have been any better of a solution for the redirects. Currently the indexing procedure is ignorant of any HOCON data. I think influencing protosearch indexing via HOCON should be supported in the protosearch laika module itself. There's some WIP-ish stuff here: cozydev-pink/protosearch#347 but that kinda stalled once I realized it wouldn't work for our complex author objects we use here, only for flat/scalar values. All this to say, I think we should have some HOCON support, but I don't think we should hold up this PR waiting for it. |

Updates to latest protosearch snapshot, which let's us exclude paths and specify our config just once.
Excluding the 404 page
Before:

After:
