Set up Algolia

What you need: Simply Static Pro

Algolia is a hosted search service. Unlike Fuse.js, which runs locally in the browser from a small index file, Algolia stores your search index on its own servers and your static site queries it through the Algolia API. It's a great fit for larger sites or when you want more advanced search features. Algolia has a free tier that covers a generous number of searches per month.

Enable search and choose Algolia

Go to Simply Static > Search, turn on Use search, and set Search Type to Algolia.

The general search options (search results page, submit button, excerpt display, placeholder text) and the Indexing settings (the title, content, and excerpt selectors, plus Exclude URLs) work exactly the same as they do for Fuse. See Set up Fuse JS for a walkthrough of those shared options. This article focuses on the parts that are specific to Algolia.

Get your Algolia credentials

Create an account at algolia.com, then create an application and an index in the Algolia dashboard. You'll need three values, all found in the dashboard under Settings > API keys:

  • Application ID
  • Admin API Key
  • Search-Only API Key

Algolia's own documentation covers finding and managing these: API keys. Because Algolia's dashboard changes over time, we point to their docs rather than repeat their screens here.

Add your Algolia settings

In the Algolia API section of the Search settings, fill in the fields:

  • Application ID: your Algolia App ID.
  • Admin API Key: used inside WordPress to build and push your index to Algolia. Keep this private.
  • Search-Only API Key: used on the static site to run searches. This is the only key that appears in your published static files.
  • Name for your index: the name of the Algolia index to use, for example simply_static .
  • CSS-selector: the selector for the <form>  element that contains your search input. If you have multiple search elements with different selectors, separate them with commas, such as .search-form, .custom-search-form .

To find the selector, open your site in a browser, right-click your search box, choose Inspect, and use the ID or class of the <form>  element that wraps the input.

A note on the two keys

Your Admin API Key can be used to change and delete data, so treat it like a password. Simply Static only uses it server-side, inside WordPress, to push your content to Algolia. It is never written into your static files.

The Search-Only API Key is the one embedded in your static site, allowing visitors to search. It's designed to be public and can only run searches, so it's safe to expose. Be careful never to paste your Admin key into the Search-Only field.

Build the index

Click Save Settings, then run a Push. Simply Static uses your Admin key to send your indexed content to Algolia, and your static site then searches that index using the Search-Only key.