Skip to content

Commit

Permalink
fix: docusaurus-version should work with subcategory
Browse files Browse the repository at this point in the history
  • Loading branch information
endiliey committed Nov 23, 2018
1 parent 2df14fe commit 35c3bd6
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions v1/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
Expand Down

0 comments on commit 35c3bd6

Please sign in to comment.