mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-13 09:07:29 +02:00
feat: sub-categories in sidebar.json (#892)
* Add ability to specify sub categories in sidebar.json * move v1 files to correct place * refactor implementation * refactor naming for implementation clarity
This commit is contained in:
parent
d052feec40
commit
954456088c
14 changed files with 535 additions and 88 deletions
|
@ -66,10 +66,30 @@ function autoPrefixCss(cssContent) {
|
|||
.then(result => result.css);
|
||||
}
|
||||
|
||||
// Validate the docs in the sidebar are valid
|
||||
function validateSidebar(metadata, sidebarMetadatas) {
|
||||
if (metadata.next) {
|
||||
if (!sidebarMetadatas[metadata.next]) {
|
||||
throw new Error(
|
||||
metadata.version
|
||||
? `Improper sidebars file for version ${
|
||||
metadata.version
|
||||
}, document with id '${
|
||||
metadata.next
|
||||
}' not found. Make sure that all documents with ids specified in this version's sidebar file exist and that no ids are repeated.`
|
||||
: `Improper sidebars.json file, document with id '${
|
||||
metadata.next
|
||||
}' not found. Make sure that documents with the ids specified in sidebars.json exist and that no ids are repeated.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSubDir,
|
||||
getLanguage,
|
||||
isSeparateCss,
|
||||
minifyCss,
|
||||
autoPrefixCss,
|
||||
validateSidebar,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue