From 629f25822db751f10c75f33e05586b63b837fcb3 Mon Sep 17 00:00:00 2001 From: Zhe Zhang Date: Tue, 7 Nov 2023 03:01:12 -0800 Subject: [PATCH] Enable search --- .gitignore | 1 + algolia.json | 46 ++++++++++++++++++++++++++++++++++++++++++++ docusaurus.config.js | 13 +++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 algolia.json diff --git a/.gitignore b/.gitignore index b2d6de3..b083ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ # Misc .DS_Store +.env .env.local .env.development.local .env.test.local diff --git a/algolia.json b/algolia.json new file mode 100644 index 0000000..8577380 --- /dev/null +++ b/algolia.json @@ -0,0 +1,46 @@ +{ + "index_name": "badger", + "start_urls": [ + "https://slac-ml.github.io/Badger/" + ], + "sitemap_urls": [ + "https://slac-ml.github.io/Badger/sitemap.xml" + ], + "sitemap_alternate_links": true, + "stop_urls": [ + "/tests" + ], + "selectors": { + "lvl0": { + "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "type": "xpath", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "header h1", + "lvl2": "article h2", + "lvl3": "article h3", + "lvl4": "article h4", + "lvl5": "article h5, article td:first-child", + "lvl6": "article h6", + "text": "article p, article li, article td:last-child" + }, + "strip_chars": " .,;:#", + "custom_settings": { + "separatorsToIndex": "_", + "attributesForFaceting": [ + "language", + "version", + "type", + "docusaurus_tag" + ], + "attributesToRetrieve": [ + "hierarchy", + "content", + "anchor", + "url", + "url_without_anchor", + "type" + ] + } +} \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index 1ed81bb..06aa0bd 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -124,6 +124,19 @@ const config = { darkTheme: darkCodeTheme, additionalLanguages: ['python'], }, + algolia: { + // The application ID provided by Algolia + appId: 'WPJQG5P0EZ', + // Public API key: it is safe to commit it + apiKey: 'b63157c581646ac999c9ce4c3569e3e3', + indexName: 'badger', + // Optional: see doc section below + contextualSearch: true, + // Optional: Algolia search parameters + searchParameters: {}, + // Optional: path for search page that enabled by default (`false` to disable it) + searchPagePath: 'search', + }, }), }