Tools / Crawler / Netlify plugin

The plugin is configurable via the netlify.toml file and the environment variables of your Netlify Site.

Usage

1
2
3
4
5
6
7
8
[[plugins]]
package = "@algolia/netlify-plugin-crawler"
  [plugins.inputs]
  branches = ['main', 'develop', 'feat/add-algolia']
  disabled = true
  pathPrefix = "/blog"
  customDomain = "example.com"
  renderJavaScript = true

Available parameters

netlify.toml

Plugin inputs can be set in netlify.toml. They’re all optional.

Parameter Type Description
branches String array List of branches the crawler should build. By default, the plugin only builds your main branch, but you can build multiple branches. Each branch has a dedicated Algolia index, named netlify_<site-id>_<branch-name>_all. Ensure you target the right branch in your frontend.
Default is ['master','main']
mainBranch String The main project’s branch. If defined, it’s used to propagate Algolia index setting modifications to other branches. Your main branch’s Algolia index settings will be used to create a new index when the plugin runs for the first time on a new branch.
pathprefix String Your website’s prefix if it’s not at the root level. For example:
pathPrefix = "/blog" # Will alias "/blog" to "/"
customDomain String The custom domain you use (if you can’t define it through Netlify settings). For example:
# Alias "example.com" to "<your-site-url>.netlify.app"
customDomain = "example.com"
renderJavaScript Boolean If true, the crawler uses JavaScript to render your website. Useful for single page apps.
Default is false
template String Used to modify how records and schemas are extracted.
disabled Boolean If true, turns off the Netlify plugin but doesn’t remove it.
Default is false

Environment variables

The environment variables that needs to be set in your Netlify Site settings. They will be automatically added by the plugin.

Variable Required? Type Description
ALGOLIA_BASE_URL Yes String URL to target. Should be “https://crawler.algolia.com/”
ALGOLIA_API_KEY Yes String API key to authenticate the call to the crawler
ALGOLIA_DISABLED No Boolean If true, turns off the Netlify plugin but doesn’t remove it.
Default is false
Did you find this page helpful?