diff --git a/lib/generators/html/build/make_default_helpers.js b/lib/generators/html/build/make_default_helpers.js index cb10b75c9..5c669d3aa 100644 --- a/lib/generators/html/build/make_default_helpers.js +++ b/lib/generators/html/build/make_default_helpers.js @@ -679,7 +679,18 @@ module.exports = function(docMap, config, getCurrent, Handlebars){ } return ""; }, - + /** + * @function documentjs.generators.html.defaultHelpers.ifIsLastItem + * + * Renders the truthy section if the current context is the last item + * in the list. + * + * @param {Array} list + * @param {*} item + */ + ifIsLastItem: function(list, item, options){ + return list[list.length - 1] === item ? options.fn(this) : ''; + }, // makeApiSection: function(options){ var depth = (this.api && this.api !== this.name ? 1 : 0); diff --git a/site/default/templates/menu.mustache b/site/default/templates/menu.mustache index 8c222b3ed..db54eb6f2 100644 --- a/site/default/templates/menu.mustache +++ b/site/default/templates/menu.mustache @@ -6,7 +6,9 @@ {{makeTitle}} {{#if ../active.hideChildrenInMenu}} - {{> active-menu.mustache}} + {{#ifIsLastItem ../../parents .}} + {{> active-menu.mustache}} + {{/ifIsLastItem}} {{/if}} {{/each}}