From d8b5b679b39c7054243a91bee7ba578c779470e6 Mon Sep 17 00:00:00 2001 From: Joshua Fernandes Date: Wed, 4 Oct 2023 08:23:44 +1000 Subject: [PATCH] algolia -> local-search --- docusaurus.config.js | 52 ++++++++++++++++++++++++-------------------- package.json | 1 + 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 36aabb104..fb74d0350 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -78,29 +78,23 @@ const config = { themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ - algolia: { - // The application ID provided by Algolia - appId: "NSRFPEJ4NC", - - // Public API key: it is safe to commit it - apiKey: "cea41b975ad6c9a01408dfda6e0061d3", - - indexName: "teku", - - // Optional: see doc section below - contextualSearch: true, - - // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them. - externalUrlRegex: "external\\.com|domain\\.com", - - // Optional: Algolia search parameters - searchParameters: {}, - - // Optional: path for search page that enabled by default (`false` to disable it) - searchPagePath: "search", - - // ... other Algolia params - }, + // revisit this in v3 of docusaurus that is due to go GA + // algolia: { + // // The application ID provided by Algolia + // appId: "NSRFPEJ4NC", + // // Public API key: it is safe to commit it + // apiKey: "cea41b975ad6c9a01408dfda6e0061d3", + // indexName: "teku", + // // Optional: see doc section below + // contextualSearch: true, + // // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them. + // externalUrlRegex: "external\\.com|domain\\.com", + // // Optional: Algolia search parameters + // searchParameters: {}, + // // Optional: path for search page that enabled by default (`false` to disable it) + // searchPagePath: "search", + // // ... other Algolia params + // }, // announcementBar: { // id: "announcement_bar", // content: "⛔️ This documentation site is still under construction! 🚧", @@ -442,7 +436,17 @@ const config = { }, ], ], - themes: [], + themes: [ + [ + require.resolve("@easyops-cn/docusaurus-search-local"), + /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */ + ({ + hashed: true, + docsRouteBasePath: "/", + indexBlog: false, + }), + ], + ], }; module.exports = config; diff --git a/package.json b/package.json index 644ce16ac..055741259 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@docusaurus/plugin-google-tag-manager": "^2.4.3", "@docusaurus/preset-classic": "^2.4.3", "@docusaurus/theme-common": "^2.4.3", + "@easyops-cn/docusaurus-search-local": "^0.33.6", "@mdx-js/react": "^1.6.22", "clsx": "^1.2.1", "prism-react-renderer": "^1.3.5",