mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
docs: improve algolia integration instructions (#6008)
* docs: improve algolia integration instructions The current version makes it look like you need to install `@docusaurus/theme-search-algolia` on top the classic version to work, but it already works with the classic version. Adding `@docusaurus/theme-search-algolia` on top leads to errors. * Still document installation * Do not make separate paragraph Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
b1a4f3913d
commit
8359ff36cd
1 changed files with 20 additions and 2 deletions
|
@ -58,14 +58,32 @@ It is highly recommended using a config similar to the [**Docusaurus 2 website c
|
||||||
|
|
||||||
### Connecting Algolia {#connecting-algolia}
|
### Connecting Algolia {#connecting-algolia}
|
||||||
|
|
||||||
Docusaurus' own `@docusaurus/preset-classic` supports an Algolia DocSearch integration.
|
Docusaurus' own `@docusaurus/preset-classic` supports Algolia DocSearch integration. If you use the classic preset, no additional installation is needed.
|
||||||
|
|
||||||
To connect your docs with Algolia, first add the package to your website:
|
<details>
|
||||||
|
<summary>Installation steps when not using <code>@docusaurus/preset-classic</code></summary>
|
||||||
|
|
||||||
|
1. Install the package:
|
||||||
|
|
||||||
```bash npm2yarn
|
```bash npm2yarn
|
||||||
npm install --save @docusaurus/theme-search-algolia
|
npm install --save @docusaurus/theme-search-algolia
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2. Register the theme in `docusaurus.config.js`:
|
||||||
|
|
||||||
|
```js title="docusaurus.config.js"
|
||||||
|
module.exports = {
|
||||||
|
title: 'My site',
|
||||||
|
// ...
|
||||||
|
themes: ['@docusaurus/theme-search-algolia'],
|
||||||
|
themeConfig: {
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
Then, add an `algolia` field in your `themeConfig`. **[Apply for DocSearch](https://docsearch.algolia.com/apply/)** to get your Algolia index and API key.
|
Then, add an `algolia` field in your `themeConfig`. **[Apply for DocSearch](https://docsearch.algolia.com/apply/)** to get your Algolia index and API key.
|
||||||
|
|
||||||
```jsx title="docusaurus.config.js"
|
```jsx title="docusaurus.config.js"
|
||||||
|
|
Loading…
Add table
Reference in a new issue