Skip to content

Commit

Permalink
docs(algolia): use one search-index per branch (#2513)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Dec 30, 2023
1 parent a87602b commit c10899b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/.vitepress/config.ts
@@ -1,7 +1,12 @@
import type { UserConfig } from 'vitepress';
import type { DefaultTheme } from 'vitepress/theme';
import { apiPages } from './api-pages';
import { currentVersion, oldVersions, versionBannerInfix } from './versions';
import {
algoliaIndex,
currentVersion,
oldVersions,
versionBannerInfix,
} from './versions';

type SidebarItem = DefaultTheme.SidebarItem;

Expand Down Expand Up @@ -128,7 +133,7 @@ const config: UserConfig<DefaultTheme.Config> = {
: {
apiKey: process.env.API_KEY,
appId: process.env.APP_ID,
indexName: 'fakerjs',
indexName: algoliaIndex,
},

footer: {
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/versions.ts
Expand Up @@ -74,3 +74,7 @@ export const oldVersions = [
link: `https://v${semver.major(version)}.fakerjs.dev/`,
})),
].filter(({ link }) => link !== hiddenLink);

export const algoliaIndex = isReleaseBranch
? `fakerjs-v${semver.major(version)}`
: 'fakerjs-next';

0 comments on commit c10899b

Please sign in to comment.