From 5bb4730f7f48153ae006d7878431d0b58b0fffee Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Fri, 27 Nov 2020 17:21:10 +0100 Subject: [PATCH] feat: add Algolia DocSearch (#40) (#153) close #40 --- docs/.vitepress/config.js | 6 + package.json | 3 + src/client/theme-default/Layout.vue | 15 +- .../components/AlgoliaSearchBox.vue | 148 ++++++++++++++++ src/client/theme-default/styles/vars.css | 7 +- yarn.lock | 162 ++++++++++++++++++ 6 files changed, 337 insertions(+), 4 deletions(-) create mode 100644 src/client/theme-default/components/AlgoliaSearchBox.vue diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 41c30bedb5ce..970cec81a83f 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -17,6 +17,12 @@ module.exports = { placement: 'vuejsorg' }, + algolia: { + apiKey: 'c57105e511faa5558547599f120ceeba', + indexName: 'vitepress' + // algoliaOptions: { facetFilters: ['tags:guide,api'] } + }, + nav: [ { text: 'Guide', link: '/' }, { text: 'Config Reference', link: '/config/basics' }, diff --git a/package.json b/package.json index 5dfb64057152..178883519d39 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,11 @@ "url": "https://github.com/vuejs/vitepress/issues" }, "dependencies": { + "@docsearch/css": "^1.0.0-alpha.28", + "@docsearch/js": "^1.0.0-alpha.28", "@vue/compiler-sfc": "^3.0.3", "@vue/server-renderer": "^3.0.3", + "algoliasearch": "^4.8.1", "chalk": "^4.1.0", "debug": "^4.1.1", "diacritics": "^1.3.0", diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index cd5598b84198..f5a388e0d788 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -3,7 +3,12 @@