mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 20:57:17 +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 => {
|
Object.keys(categories).forEach(category => {
|
||||||
versioned[versionSidebar][category] = [];
|
versioned[versionSidebar][category] = [];
|
||||||
|
|
||||||
const ids = categories[category];
|
const categoryItems = categories[category];
|
||||||
ids.forEach(id => {
|
categoryItems.forEach(categoryItem => {
|
||||||
versioned[versionSidebar][category].push(`version-${version}-${id}`);
|
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