Netlify is our recommend way to host static websites. Each time you push your content to your repository, it will build your website and host it.
It takes care of all the building and hosting for you, and you can even run
custom commands (like
jekyll algolia) as part of the build process.
To enable Netlify automatic deploy for your Jekyll project, follow those steps:
Netlify UI will suggest a command to run and a website to serve by default. We
recommend instead to create a file named
netlify.toml at the root of your
repository. Having all configuration stored in a local file instead of a web UI
will make its management easier.
# netlify.toml # This file should be at the root of your project [build] command = "jekyll build && jekyll algolia" publish = "_site"
This file will be read by Netlify on each push to your repo. Because you have
Gemfile in your project, Netlify will automatically detect that it’s a Ruby
project and will setup Bundler for you, making the use of
It will then run the defined
command, building the website and then pushing
records to Algolia. Once done, the directory specified in
publish will be
deployed and publicly available.
By default Netlify uses Ruby v2.1.2. This version is not compatible with the
To fix this, you’ll have to add a file named
.ruby-version at the root of your
repository. The file content should be
2.4. It will be picked up by Netlify
and used as the local Ruby version.
# .ruby-version # This file should be at the root of your project # Don't forget to remove those comments! 2.4
The plugin will need your Admin API key to push data. Because you don’t want to
expose this key in your repository, you’ll have to add
ALGOLIA_API_KEY as an
environment variable to Netlify. You can do that through the UI, in your Netlify
Commit all the changes you made, and then push your repository. Netlify will catch the event and trigger your build and indexing for you. You can follow the Netlify job execution directly on your Netlify dashboard, with a full log.