Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(algolia): use one search-index per branch #2513

Merged
merged 11 commits into from
Dec 30, 2023
9 changes: 7 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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';