* Update installation.md * Update cli-usage.md * Update installation.md * Update directory-structure.md * Update configuration.md * Update overview.md * Update section.md * Update page.md * Update section.md * Update configuration.md * Update page.md * Update section.md * Update page.md * Update shortcodes.md * Update linking.md * Update table-of-contents.md * Update syntax-highlighting.md * Update taxonomies.md * Update search.md * Update sass.md * Update index.md * Update multilingual.md * Update overview.md * Update pages-sections.md * Update pagination.md * Update taxonomies.md * Update rss.md * Update sitemap.md * Update robots.md * Update 404.md * Update archive.md * Update overview.md * Update installing-and-using-themes.md * Update creating-a-theme.md * Update netlify.md * Update github-pages.md * Update gitlab-pages.md * Update index.md * Update page.md * Update section.md * Updates.
1.1 KiB
+++ title = "Search" weight = 100 +++
Zola can build a search index from the sections and pages content to be used by a JavaScript library such as elasticlunr.
To enable it, you only need to set build_search_index = true
in your config.toml
and Zola will
generate an index for the default_language
set for all pages not excluded from the search index.
It is very important to set the default_language
in your config.toml
if you are writing a site not in
English; the index building pipelines are very different depending on the language.
After zola build
or zola serve
, you should see two files in your static directory:
search_index.${default_language}.js
: sosearch_index.en.js
for a default setupelasticlunr.min.js
As each site will be different, Zola makes no assumptions about your search function and doesn't provide the JavaScript/CSS code to do an actual search and display results. You can look at how this site implements it to get an idea: search.js.