refactor(v2): use new way to get versions for search page ()

* refactor(v2): use new way to get versions for search page

* search page: support docs multi-instance

Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
Alexey Pyltsyn 2020-10-22 12:22:11 +03:00 committed by GitHub
parent 44535f7555
commit 0ec5d533d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 74 deletions
packages/docusaurus-plugin-content-docs/src/theme/hooks

View file

@ -1,30 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
let versions: string[];
try {
// eslint-disable-next-line global-require
versions = require('@site/versions.json');
} catch {
versions = [];
}
// TODO deprecate in favor of useDocs.ts instead
function useVersioning(): {
versioningEnabled: boolean;
versions: string[];
latestVersion: string;
} {
return {
versioningEnabled: versions.length > 0,
versions,
latestVersion: versions[0],
};
}
export default useVersioning;