Skip to content

Commit ea8aa21

Browse files
committed
docs: document algolia option
1 parent 702d676 commit ea8aa21

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

Diff for: docs/config/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,24 @@ The `serviceWorker` option only handles the service worker. To make your site fu
9898
Also, only enable this if you are able to deploy your site with SSL, since service worker can only be registered under HTTPs URLs.
9999
:::
100100

101+
### algolia
102+
103+
- Type: `Object`
104+
- Default: `undefined`
105+
106+
Using `algolia` option allows you to disable the default built-in headers-based search and leverage the [algolia docsearch](https://github.com/algolia/docsearch), to enable this search, You have to provide at least `apiKey` and `indexName`:
107+
108+
```js
109+
module.exports = {
110+
algolia: {
111+
apiKey: '<API_KEY>',
112+
indexName: '<INDEX_NAME>'
113+
}
114+
}
115+
```
116+
117+
Rest available options refer to [docsearch options](https://github.com/algolia/docsearch#docsearch-options).
118+
101119
### locales
102120

103121
- Type: `{ [path: string]: Object }`

Diff for: docs/zh/config/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ module.exports = {
9797
当然,仅仅只在你的网站部署后能用 SSL 的时候开启它,因为 service worker 只能在 HTTPs 的链接下注册。
9898
:::
9999

100+
### algolia
101+
102+
- 类型: `Object`
103+
- 默认值: `undefined`
104+
105+
使用 `algolia` 选项可以让你禁用掉默认的基于 headers 的搜索,从而使用 [algolia docsearch](https://github.com/algolia/docsearch)。为了使其生效,你必须提供至少 `apiKey``indexName` 这两个选项:
106+
107+
```js
108+
module.exports = {
109+
algolia: {
110+
apiKey: '<API_KEY>',
111+
indexName: '<INDEX_NAME>'
112+
}
113+
}
114+
```
115+
116+
其他可用的选项可以参考 [docsearch options](https://github.com/algolia/docsearch#docsearch-options)
117+
100118
### locales
101119

102120
- 类型: `{ [path: string]: Object }`

Diff for: lib/default-theme/Navbar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default {
3333
},
3434
isAlgoliaSearch () {
3535
const algolia = this.algolia
36-
return algolia && algolia.appId && algolia.apiKey && algolia.indexName
36+
return algolia && algolia.apiKey && algolia.indexName
3737
},
3838
isSearch() {
3939
return !this.isAlgoliaSearch && this.$site.themeConfig.search !== false

0 commit comments

Comments
 (0)