Options

The plugin should work out of the box for most websites, but there are options you can tweak if needed. All the options should be added under the algolia section of your _config.yml file.

You should be familiar with how this plugin works under the hood to better understand what some options are doing.

extensions_to_index

This options defines which source files should be indexed, based on their file extension. If an extension is not in the list, then the file will not be indexed.

By default, all HTML and markdown source files will be indexed.

If you are using another markup language (such as AsciiDoc or Textile, you might want to update the value like this:

algolia: # Also index AsciiDoc and Textile files extensions_to_index: 'html,md,adoc,textile'

files_to_exclude

This option lets you define a blacklist of source files you don’t want to index.

By default it will exclude all the index.html and index.md files. Those files are usually not containing much text (landing pages) or containing redundant text (latest blog articles) so they are not included by default.

If you want to index those files, you should set the value to an empty array.

algolia: # Actually index the index.html/index.md pages files_to_exclude: []

If you want to exclude more files, you should add them to the array. Note that you can use glob patterns to exclude several files at once.

algolia: # Exclude more files from indexing files_to_exclude: - index.html - index.md - excluded-file.html - _posts/2017-01-20-date-to-forget.md - subdirectory/*.html

Note that some files (pagination pages, static assets, etc) will always be excluded and you don’t have to specify them.

nodes_to_index

This options defines how each page is split into chunks. It expects a CSS selector that will be applied on the HTML content generated by Jekyll. Each matching node will be indexed as a different record.

The default value is p, meaning that one record will be created for each <p> paragraph of content.

If you would like to index other elements, like <blockquote>, <li> or a custom <div class="paragraph">, you should edit the value like this:

algolia: # Also index quotes, list items and custom paragraphs nodes_to_index: 'p,blockquote,li,div.paragraph'

indexing_mode

This option will let you choose the strategy used to sync your data with your Algolia index. The default value should work for most cases, but feel free to read the pros and cons of each and pick the one best suited for your needs.

settings

This option let you pass specific settings to your Algolia index.

By default the plugin will configure your Algolia index with settings tailored to the format of the extracted records. You are of course free to overwrite them or configure them as best suits your needs. Every option passed to the settings entry will be set as settings to your index.

For example if you want to change the HTML tag used for the highlighting, you can overwrite it like this:

algolia: settings: highlightPreTag: '<em class="custom_highlight">' highlightPostTag: '</em>'

indexing_batch_size

The Algolia API allows you to send batches of changes to add or update several records at once, instead of doing one HTTP call per record. The plugin will batch updates by groups of 1000 records by default.

If you are on an unstable internet connection, you might want to decrease the value. You will send more batches, but each will be smaller in size.

algolia: # Send fewer records per batch indexing_batch_size: 500