Indexer


This feature works only for Server Side Rendered (SSR) applications. If you are using Statically Generated Site, please use Serverless functions instead.

Storyblok

If you are interested in building a Nuxt 3 application with Algolia search that is powered by Storyblok CMS (with automatic Algolia search indexing) you can check out the article for Storyblok about it here. It explains how to build the indexer from scratch. You can also use the built in indexer that does the same thing.

In order to enable it, first add indexer configuration option to module configuration:

import { defineNuxtConfig } from 'nuxt'export default defineNuxtConfig({  modules: ['@nuxtjs/algolia'],  algolia: {    apiKey: process.env.ALGOLIA_SEARCH_API_KEY,    applicationId: process.env.ALGOLIA_APPLICATION_ID,    indexer: {      storyblok: {        secret: process.env.INDEXER_SECRET,        algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,        indexName: process.env.ALGOLIA_INDEX_NAME,        accessToken: process.env.STORYBLOK_ACCESS_TOKEN      }    }})

It will automatically register a new server middleware that you can access manually or by using a webhook to trigger automatic indexing after content change. Remember to create appriopriate secret property and add it to the webhook configuration so that the indexing could be triggered correctly. You can test if it works correctly by accessing a /api/indexer?secret=<YOUR_SECRET>