<% const sheets = this.sheets.filter(sheet => Boolean(sheet.image)); %> <% const pages = sheets.map((v, i) => sheets.slice(i, i + 2)).filter(Boolean); %>
<% for (const [index, page] of pages.entries()) { %>
<% for (const sheet of page) { %>
<% } %>
<% } %> <% if (sheets.length % 2 === 0) { %>
<% } %>