Sort usage directory by type first #8
|
@ -4,6 +4,15 @@
|
|||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||
|
||||
// order usage directory by type first
|
||||
function sortItemsByCategory(items) {
|
||||
// type with "category" (directory) first
|
||||
const sortedItems = items.sort(function(a, b) {
|
||||
return a.type.localeCompare(b.type);
|
||||
})
|
||||
return sortedItems;
|
||||
}
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'Gitea Documentation',
|
||||
|
@ -39,6 +48,16 @@ const config = {
|
|||
label: '1.19.3'
|
||||
}
|
||||
},
|
||||
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
|
||||
const {item} = args;
|
||||
// Use the provided data to generate a custom sidebar slice
|
||||
const sidebarItems = await defaultSidebarItemsGenerator(args);
|
||||
if (item.dirName !== 'usage') {
|
||||
return sidebarItems;
|
||||
} else {
|
||||
return sortItemsByCategory(sidebarItems);
|
||||
}
|
||||
},
|
||||
},
|
||||
blog: false,
|
||||
theme: {
|
||||
|
|
10
i18n/en/docusaurus-plugin-content-docs/current.json
Normal file
10
i18n/en/docusaurus-plugin-content-docs/current.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"sidebar.defaultSidebar.category.actions": {
|
||||
"message": "Actions",
|
||||
"description": "The label for category actions in sidebar defaultSidebar"
|
||||
},
|
||||
"sidebar.defaultSidebar.category.packages": {
|
||||
"message": "Packages",
|
||||
"description": "The label for category packages in sidebar defaultSidebar"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user