antora-lunr icon indicating copy to clipboard operation
antora-lunr copied to clipboard

Correlate titles with the search results

Open felipethome opened this issue 5 years ago • 2 comments

Hi! Is there a way to correlate the titles inside a document with the metadata in the search result?

UPDATE: I just saw https://github.com/Mogztter/antora-lunr/blob/13e6afea4f63b9dad88ff4549f8d3403f15f24a5/lib/generate-index.js#L83, can you give a quick explanation of what you have in mind?

felipethome avatar Dec 18 '19 00:12 felipethome

What do you think about getting the content of all <p> and relate them to the closest <h$> header. Then instead of one doc per page create one doc per section?

felipethome avatar Dec 18 '19 03:12 felipethome

Hi Felipe!

It should be possible... I guess it can make sense when you have a relatively small documentation site (and/or really long page)? But for now you will have to override the generateIndex function because Antora does not have a built-in mechanism to extend and/or configure a generator.

For now we are using environment variable to enable features but that's far from being a good configuration system :disappointed:

ggrossetie avatar Dec 18 '19 16:12 ggrossetie

Development continues on https://gitlab.com/antora/antora-lunr-extension/

ggrossetie avatar Nov 26 '22 09:11 ggrossetie