Search
Zluinav has search built-in. This is a quick overview on how to create your search.
Configuration
Search Formats
You have a variety of formats to choose for your search.
main
This format uses the default searching method configured in search according to Zola's documentation. search.js
in the static folder provides for elasticlunr
.
pagefind
This is the default used in Zluinav's demo and is a third party searching tool, and thus it cannot be used in zola serve
. Instead, this is best if you run this tool after the build. In short, this tool runs over your HTML files to generate the search, and it only takes up a few seconds.
Setup Pagefind
Setup Pagefind
Do the following to get up and run Pagefind. We'll asume you have Python installed:
- Install Pagefind extended version. You can do this by this command up to the root of this repository.
pip install -r requirements.txt
- Set the search format in the
searching
object. - Build the site.
zola build
- Generate the search index. Make sure to replace outputdir with the directory where your built files live.
python -m pagefind --site outputdir
- Make sure to add
html
tag with thelang
attribute set if you are building multilingual search. - If you want to define where to start searching from, add
data-pagefind
to a tag like div.
That's it!