<%= title %> <%= author %> <% var _index = 0; %> <% content.forEach(function(content, index){ %> <% if(!content.excludeFromToc && content.beforeToc){ %> <%= (1+index) + ". " + (content.title || "Chapter " + (1+index))%> <% } %> <% }) %> <%= tocTitle %> <% content.forEach(function(content, index){ %> <% if(!content.excludeFromToc && !content.beforeToc){ %> <%= (1+index) + ". " + (content.title || "Chapter " + (1+index))%> <% } %> <% }) %>