mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 08:37:25 +02:00
Add ability to specify sub categories in sidebar.json (#891)
This commit is contained in:
parent
dd9d05c84d
commit
16087b4428
14 changed files with 534 additions and 87 deletions
|
@ -64,10 +64,30 @@ function autoPrefixCss(cssContent) {
|
|||
.then(result => result.css);
|
||||
}
|
||||
|
||||
// Validate the docs in the sidebar are valid
|
||||
function validateSidebar(metadata, pages) {
|
||||
if (metadata.next) {
|
||||
if (!pages[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