mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-28 07:27:49 +02:00
chore(plugin-docs): remove legacy versioned prefix on doc ids and sidebar names in versioned sidebars (#9310)
This commit is contained in:
parent
f5ae537d3e
commit
598b32011f
25 changed files with 264 additions and 396 deletions
|
@ -21,7 +21,7 @@ import type {Sidebars} from './sidebars/types';
|
|||
|
||||
function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
||||
return {
|
||||
id: doc.unversionedId,
|
||||
id: doc.id,
|
||||
path: doc.permalink,
|
||||
|
||||
// optimize global data size: do not add unlisted: false/undefined
|
||||
|
@ -56,10 +56,7 @@ function toGlobalSidebars(
|
|||
path:
|
||||
firstLink.type === 'generated-index'
|
||||
? firstLink.permalink
|
||||
: version.docs.find(
|
||||
(doc) =>
|
||||
doc.id === firstLink.id || doc.unversionedId === firstLink.id,
|
||||
)!.permalink,
|
||||
: version.docs.find((doc) => doc.id === firstLink.id)!.permalink,
|
||||
label: firstLink.label,
|
||||
},
|
||||
};
|
||||
|
@ -76,7 +73,7 @@ export function toGlobalDataVersion(version: FullVersion): GlobalVersion {
|
|||
docs: version.docs
|
||||
.map(toGlobalDataDoc)
|
||||
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
|
||||
draftIds: version.drafts.map((doc) => doc.unversionedId),
|
||||
draftIds: version.drafts.map((doc) => doc.id),
|
||||
sidebars: toGlobalSidebars(version.sidebars, version),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue