kamon-io / kamon.io

Sources for the https://kamon.io/ website.
9 stars 57 forks source link

Start the DocSearch integration #99

Closed ivantopo closed 3 years ago

ivantopo commented 3 years ago

I had a quick attempt at integrating Algolia's DocSearch but need some CSS magic help here. Issues I found so far can be seen in this image: image

For the second problem, I'm under the impression that we have to tweak something on the crawling configuration (there is a lot of interesting info regarding the config file format here). So far, I think we must change the start_urls value and add strip_chars as shown here:

{
  "index_name": "kamon",
  "start_urls": [
    "https://kamon.io/docs/latest/overview/"
  ],
  "stop_urls": [],
  "selectors": {
    "lvl0": {
      "selector": "",
      "global": true,
      "default_value": "Documentation"
    },
    "lvl1": "#docs-content h1",
    "lvl2": "#docs-content h2",
    "lvl3": "#docs-content h3",
    "lvl4": "#docs-content h4",
    "lvl5": "#docs-content h5",
    "text": "#docs-content p, #docs-content li"
  },
  "strip_chars": "#",
  "conversation_id": [
    "1479974323"
  ],
  "nb_hits": 1524
}

But we might need to do something else with the selectors for the text to show up as expected.

the-overengineer commented 3 years ago

Regarding config updates - yes, these will need to be updated for sure. However, they will have little effect on what is shown as text - it will show the text only when it's what matched, and headings get higher priority. To partially alleviate this, I've bumped the results shown to 12.