diff --git a/lib/load/docs/index.js b/lib/load/docs/index.js index 9cd9ad496d..aaaace5b51 100644 --- a/lib/load/docs/index.js +++ b/lib/load/docs/index.js @@ -102,9 +102,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { }) ); - /* - Get the titles of the previous and next ids so that we can use them - */ + /* Get the titles of the previous and next ids so that we can use them */ Object.keys(docsMetadatas).forEach(currentID => { const previousID = idx(docsMetadatas, [currentID, 'previous']); if (previousID) { diff --git a/lib/theme/Docs/index.js b/lib/theme/Docs/index.js index db1b7da79e..8d4217d37f 100644 --- a/lib/theme/Docs/index.js +++ b/lib/theme/Docs/index.js @@ -22,16 +22,19 @@ export default class Docs extends React.Component { {thisSidebar[categoryName].map(rawLinkID => { const linkID = (language ? `${language}-` : '') + rawLinkID; const linkMetadata = docsMetadatas[linkID]; + if (!linkMetadata) { + throw new Error( + `Improper sidebars.json file, document with id '${linkID}' not found.` + ); + } const linkClassName = linkID === thisID ? 'navListItemActive' : 'navListItem'; return ( - linkMetadata && ( -