About DocSearch Config file

Hi, I’m very newbie for constructing website and
I’m struggling to add DocSearch to my website with this page. (https://community.algolia.com/docsearch/run-your-own.html)

The website is made by Hugo and hosted by Netlify.

My problems is:

  • I have no idea about what value is needed in config.json file.

The documentation explains as following code.
And I found the value for “index_name” and “start_urls”(not sure)
but I couldn’t find the values for “lvl0” ~ “lvl5” and “text”.

  "index_name": "example",
  "start_urls": ["https://www.example.com/docs"],
  "selectors": {
    "lvl0": "#content header h1",
    "lvl1": "#content article h1",
    "lvl2": "#content section h3",
    "lvl3": "#content section h4",
    "lvl4": "#content section h5",
    "lvl5": "#content section h6",
    "text": "#content header p,#content section p,#content section ol"

And I want to know about the above parameters are enough or need extra parameters for config.json file.

I’ll wait for any help from anybody.
Thanks for read my topic.


Levels lvlX are used to split your content according to headings. The value should be a CSS accessor to find the title of the page (lvl0) and it’s subtitles, usually h2 and h3.

Typically with the following HTML you’ll get the following config.

<section id="content">

  <header id="title">
    <h1>Something interesting</h1>


    <p>Lorem ipsum</p>
    <p>Lorem ipsum</p>

    <h2>A subtitle in the content</h2>
    <p>Lorem ipsum</p>
    <p>Lorem ipsum</p>


  "index_name": "example",
  "start_urls": ["https://www.example.com/docs"],
  "selectors": {
    "lvl0": "#content #title h1",
    "lvl1": "#content article h2",
    "lvl2": "#content article h3",
    "text": "#content article p,#content article ol,#content article ul#content article blockquote"

Please let me know if that helps.


1 Like

Thanks Julien,

So ‘#’ in the selectors means CSS ‘id’ and ‘non-#’ means just tag’s name.
And in the “text”, I have to include everything I used
except the things which are already contained in lvl0 ~ lvl5, right?

By the way, does DocSearch support only html & CSS file?
My contents are made of Markdown file…
Markdown has no h1, article tags.

Is there anyway using Markdown file or do I have to write the contents in HTML file?

Heeam Shin