diff options
author | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-04-01 00:45:49 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@friendco.de> | 2014-04-01 00:45:52 -0700 |
commit | f7767484371bac0948cddffe916de014a2413c93 (patch) | |
tree | 2df2f5a4667d21b429b3f72d46e9c3a05d85465f | |
parent | bb96433fe34eddeb0d0d70bcf52109cdfac81255 (diff) | |
download | gitbook-f7767484371bac0948cddffe916de014a2413c93.zip gitbook-f7767484371bac0948cddffe916de014a2413c93.tar.gz gitbook-f7767484371bac0948cddffe916de014a2413c93.tar.bz2 |
Don't add chapters/articles with null paths to navigation
-rw-r--r-- | lib/parse/navigation.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/parse/navigation.js b/lib/parse/navigation.js index 2680251..abe0ee2 100644 --- a/lib/parse/navigation.js +++ b/lib/parse/navigation.js @@ -31,6 +31,9 @@ function navigation(summary, files) { // Walk the chapter/article tree and create navigation entires _.each(summary.chapters, function(chapter, idx, chapters) { + // Skip if no path + if(!chapter.path) return; + var currentChapter = clean(chapter); var prevChapter = (idx-1 < 0) ? README_NAV : chapters[idx-1]; var nextChapter = (idx+1 >= chapters.length) ? null : chapters[idx+1]; @@ -49,6 +52,8 @@ function navigation(summary, files) { // Check a chapter's articles _.each(chapter.articles, function(article, _idx, articles) { + // Skip if no path + if(!article.path) return; var prev = (_idx-1 < 0) ? currentChapter : clean(articles[_idx-1]); var next = (_idx+1 >= articles.length) ? nextChapter : clean(articles[_idx+1]); |