<% if (model.children && model.children.length) { %>
<% if (
model.depth >= startingDepth &&
model.depth <= maxDepth
) { %>
<% _.each(model.children, function(child) { %>
<%= templateFn({
model: child,
templateFn: templateFn,
startingDepth: startingDepth,
maxDepth: maxDepth
}) %>
<% }); %>
<% } %>
<% } %>
<% if (model.depth == maxDepth + 1 && model.children) { %>
Continue this thread →
<% } %>