Skip to content

Commit

Permalink
[docs-beta] add algolia search when deployed (#24668)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmpadden authored Sep 23, 2024
1 parent ab69376 commit 6a946dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/docs-beta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,15 @@ yarn sync-api-docs && yarn build
```

This runs the `scripts/vercel-sync-api-docs.sh` script which builds the MDX files using the custom `sphinx-mdx-builder`, and copies the resulting MDX files to `docs/api`.

## Search

Algolia search is used for search results on the website, as configured in `docusaurus.config.ts`.

The following environment variables must be configured in Vercel:

- `ALGOLIA_APP_ID`
- `ALGOLIA_API_KEY`
- `ALGOLIA_INDEX_NAME`

These variables are not loaded when `process.env.ENV === 'development'`.
10 changes: 10 additions & 0 deletions docs/docs-beta/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ const config: Config = {
require.resolve('docusaurus-plugin-image-zoom'),
],
themeConfig: {
// Algolia environment variables are not required during development
algolia:
process.env.NODE_ENV === 'development'
? null
: {
appId: process.env.ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_API_KEY,
indexName: process.env.ALGOLIA_INDEX_NAME,
contextualSearch: false,
},
announcementBar: {
id: 'announcementBar',
// TODO - once discussion has been created update link
Expand Down

0 comments on commit 6a946dc

Please sign in to comment.