You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

search.md 1.1KB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
12345678910111213141516171819202122
  1. +++
  2. title = "Search"
  3. weight = 100
  4. +++
  5. Zola can build a search index from the sections and pages content to
  6. be used by a JavaScript library such as [elasticlunr](http://elasticlunr.com/).
  7. To enable it, you only need to set `build_search_index = true` in your `config.toml` and Zola will
  8. generate an index for the `default_language` set for all pages not excluded from the search index.
  9. It is very important to set the `default_language` in your `config.toml` if you are writing a site not in
  10. English; the index building pipelines are very different depending on the language.
  11. After `zola build` or `zola serve`, you should see two files in your static directory:
  12. - `search_index.${default_language}.js`: so `search_index.en.js` for a default setup
  13. - `elasticlunr.min.js`
  14. As each site will be different, Zola makes no assumptions about your search function and doesn't provide
  15. the JavaScript/CSS code to do an actual search and display results. You can look at how this site
  16. implements it to get an idea: [search.js](https://github.com/getzola/zola/tree/master/docs/static/search.js).