[{"_path":"/advanced/er","_draft":false,"_partial":false,"_empty":false,"title":"Indexer","description":"","excerpt":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"em","props":{},"children":[{"type":"text","value":"This feature works only for Server Side Rendered (SSR) applications. If you are using Statically Generated Site, please use Serverless functions instead."}]}]},{"type":"element","tag":"h2","props":{"id":"storyblok"},"children":[{"type":"text","value":"Storyblok"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"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 "},{"type":"element","tag":"a","props":{"href":"https://www.storyblok.com/tp/using-storyblok-algolia-in-nuxt-3","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":". It explains how to build the indexer from scratch. You can also use the built in indexer that does the same thing."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order to enable it, first add "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"indexer"}]},{"type":"text","value":" configuration option to module configuration:"}]},{"type":"element","tag":"code","props":{"code":"import { defineNuxtConfig } from 'nuxt'\n\nexport default defineNuxtConfig({\n modules: ['@nuxtjs/algolia'],\n algolia: {\n apiKey: process.env.ALGOLIA_SEARCH_API_KEY,\n applicationId: process.env.ALGOLIA_APPLICATION_ID,\n indexer: {\n storyblok: {\n secret: process.env.INDEXER_SECRET,\n algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,\n indexName: process.env.ALGOLIA_INDEX_NAME,\n accessToken: process.env.STORYBLOK_ACCESS_TOKEN\n }\n }\n})\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"import { defineNuxtConfig } from 'nuxt'\n\nexport default defineNuxtConfig({\n modules: ['@nuxtjs/algolia'],\n algolia: {\n apiKey: process.env.ALGOLIA_SEARCH_API_KEY,\n applicationId: process.env.ALGOLIA_APPLICATION_ID,\n indexer: {\n storyblok: {\n secret: process.env.INDEXER_SECRET,\n algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,\n indexName: process.env.ALGOLIA_INDEX_NAME,\n accessToken: process.env.STORYBLOK_ACCESS_TOKEN\n }\n }\n})\n"}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"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 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"secret"}]},{"type":"text","value":" 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 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"/api/indexer?secret="}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"element","tag":"em","props":{},"children":[{"type":"text","value":"This feature works only for Server Side Rendered (SSR) applications. If you are using Statically Generated Site, please use Serverless functions instead."}]}]},{"type":"element","tag":"h2","props":{"id":"storyblok"},"children":[{"type":"text","value":"Storyblok"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"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 "},{"type":"element","tag":"a","props":{"href":"https://www.storyblok.com/tp/using-storyblok-algolia-in-nuxt-3","rel":["nofollow","noopener","noreferrer"],"target":"_blank"},"children":[{"type":"text","value":"here"}]},{"type":"text","value":". It explains how to build the indexer from scratch. You can also use the built in indexer that does the same thing."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"In order to enable it, first add "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"indexer"}]},{"type":"text","value":" configuration option to module configuration:"}]},{"type":"element","tag":"code","props":{"code":"import { defineNuxtConfig } from 'nuxt'\n\nexport default defineNuxtConfig({\n modules: ['@nuxtjs/algolia'],\n algolia: {\n apiKey: process.env.ALGOLIA_SEARCH_API_KEY,\n applicationId: process.env.ALGOLIA_APPLICATION_ID,\n indexer: {\n storyblok: {\n secret: process.env.INDEXER_SECRET,\n algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,\n indexName: process.env.ALGOLIA_INDEX_NAME,\n accessToken: process.env.STORYBLOK_ACCESS_TOKEN\n }\n }\n})\n","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-8aa55b"},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" { "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"defineNuxtConfig"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" } "}]},{"type":"element","tag":"span","props":{"class":"ct-8aa55b"},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-a76318"},"children":[{"type":"text","value":"'nuxt'"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-8aa55b"},"children":[{"type":"text","value":"export"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-8aa55b"},"children":[{"type":"text","value":"default"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-811375"},"children":[{"type":"text","value":"defineNuxtConfig"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"({"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"modules"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": ["}]},{"type":"element","tag":"span","props":{"class":"ct-a76318"},"children":[{"type":"text","value":"'@nuxtjs/algolia'"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"],"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"algolia"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"apiKey"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"ALGOLIA_SEARCH_API_KEY"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"applicationId"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"ALGOLIA_APPLICATION_ID"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"indexer"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"storyblok"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"secret"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"INDEXER_SECRET"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"algoliaAdminApiKey"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"ALGOLIA_ADMIN_KEY"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"indexName"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"ALGOLIA_INDEX_NAME"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":","}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"accessToken"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":": "}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"process"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-be1b19"},"children":[{"type":"text","value":"env"}]},{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"."}]},{"type":"element","tag":"span","props":{"class":"ct-acbd7c"},"children":[{"type":"text","value":"STORYBLOK_ACCESS_TOKEN"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":" }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-13cc69"},"children":[{"type":"text","value":"})"}]}]}]}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"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 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"secret"}]},{"type":"text","value":" 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 "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"/api/indexer?secret="}]}]},{"type":"element","tag":"style","children":[{"type":"text","value":".ct-be1b19{color:#E5C07B}.ct-811375{color:#61AFEF}.ct-a76318{color:#98C379}.ct-acbd7c{color:#E06C75}.ct-13cc69{color:#ABB2BF}.ct-8aa55b{color:#C678DD}"}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[{"id":"storyblok","depth":2,"text":"Storyblok"}]}},"_type":"markdown","_id":"content:2.advanced:3.indexer.md","_source":"content","_file":"2.advanced/3.indexer.md","_extension":"md"},{"_path":"/advanced/crawler","_draft":false,"_partial":false,"_empty":false,"title":"Crawler","description":"","excerpt":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"crawler"},"children":[{"type":"text","value":"Crawler"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This section only applies if you are using Nuxt static site generation."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When setting the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"crawler"}]},{"type":"text","value":" option of this module (see "},{"type":"element","tag":"a","props":{"href":"/getting-started/configuration#crawler"},"children":[{"type":"text","value":"Setup"}]},{"type":"text","value":"), the module will automatically collect your pages' metadata and store them in an Algolia index. This allows you to easily add a search functionality on your website or blog without worrying about updating your indices as the process happens during the Nuxt static generation."}]}]},"body":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"crawler"},"children":[{"type":"text","value":"Crawler"}]},{"type":"element","tag":"blockquote","props":{},"children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"This section only applies if you are using Nuxt static site generation."}]}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"When setting the "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"crawler"}]},{"type":"text","value":" option of this module (see "},{"type":"element","tag":"a","props":{"href":"/getting-started/configuration#crawler"},"children":[{"type":"text","value":"Setup"}]},{"type":"text","value":"), the module will automatically collect your pages' metadata and store them in an Algolia index. This allows you to easily add a search functionality on your website or blog without worrying about updating your indices as the process happens during the Nuxt static generation."}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[{"id":"crawler","depth":2,"text":"Crawler"}]}},"_type":"markdown","_id":"content:2.advanced:5.crawler.md","_source":"content","_file":"2.advanced/5.crawler.md","_extension":"md"}]