How to set Algolia by Netlify deploy

use Netlify to deploy Algolia

Posted by Kaix on October 18, 2020 · 2 min read

Cause lazy, so I want to find a way to setting Algolia automatically. At first, I found the Travis CI - Test and Deploy with Confidence could do. But actually, the Netlify also has a service like that, when you deploy.

First, you have to set the file, Netlify.toml in the root. Tell the system, have to execute these command when the Netlify builds and deploy at next time


publish = "_site"
command = "jekyll build & jekyll algolia"

Although you set the setting, it still gets wrong. Cause we are not setting the Algolia API Key yet. You have to go to the Build & Deploy menu, set the environment variable values

**Deploy setting**

Netlify Setting Algolia

That’s all. When you post a new article, the Netlify will execute the command, and upload the data of article information to Algolia.

Netlify Environment Variables