mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 18:32:52 +02:00
refactor(v2): use new way to get versions for search page (#3604)
* 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:
parent
44535f7555
commit
0ec5d533d6
3 changed files with 94 additions and 74 deletions
packages/docusaurus-plugin-content-docs/src/theme/hooks
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue