How to index entries from Storyblok with Algolia
Storyblok is the first headless CMS that works for developers & marketers alike.
In this article, we will check out how we can index the content of Storyblok in Algolia with just a few lines of code using node.js
.
You could be interested also in our article on how to integrate Algolia with your Headless CMS.
Start a new node project using the command below:
Installation
Please install storyblok-js-client, alogoliasearch and axios according to the following code block.
Configuration of Algolia Indexer
Create index.js with the following content. The comments will guide you through the whole implementation. You will need your space preview or public token to exchange the STORYBLOK_CONTENT_DELIVERY_API_TOKEN
placeholder and your ALGOLIA_APP_ID
as well as ALGOLIA_API_ADMIN_TOKEN
.
Running the Indexer
After adding the above code and adjusting the configuration with your own needs you can execute the following command to create an index in Algolia.
Filtering Content in Storyblok
Instead of using Algolia to filter and query your content of Storyblok, we can highly recommend you to check out our Content Delivery feature called filter_query
as this allows you to perform query actions on your content without any additional indexing step when entered in Storyblok.
Summary
With just a few lines of code, you can not only access your content from Storyblok but you can easily index it using Algolia including auto-update of existing indexes and entries.
Resource | Link |
---|---|
How to integrate Algolia with your Headless CMS | https://www.storyblok.com/tp/headless-algolia-integration |
Algoalia Indexing API | https://www.algolia.com/doc/api-client/methods/indexing/ |