mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 04:37:28 +02:00
fix: docusaurus-version should work with subcategory (#1124)
This commit is contained in:
parent
2df14feafd
commit
579cc61bbf
1 changed files with 13 additions and 3 deletions
|
@ -149,9 +149,19 @@ if (versionFallback.diffLatestSidebar()) {
|
|||
Object.keys(categories).forEach(category => {
|
||||
versioned[versionSidebar][category] = [];
|
||||
|
||||
const ids = categories[category];
|
||||
ids.forEach(id => {
|
||||
versioned[versionSidebar][category].push(`version-${version}-${id}`);
|
||||
const categoryItems = categories[category];
|
||||
categoryItems.forEach(categoryItem => {
|
||||
let versionedCategoryItem = categoryItem;
|
||||
if (typeof categoryItem === 'object') {
|
||||
if (categoryItem.ids && categoryItem.ids.length > 0) {
|
||||
versionedCategoryItem.ids = categoryItem.ids.map(
|
||||
id => `version-${version}-${id}`,
|
||||
);
|
||||
}
|
||||
} else if (typeof categoryItem === 'string') {
|
||||
versionedCategoryItem = `version-${version}-${categoryItem}`;
|
||||
}
|
||||
versioned[versionSidebar][category].push(versionedCategoryItem);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue