Don't add chapters/articles with null paths to navigation

This commit is contained in:
Aaron O'Mullan
2014-04-01 00:45:49 -07:00
parent bb96433fe3
commit f776748437
+5
View File
@@ -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]);