% const sheets = this.sheets.filter(sheet => Boolean(sheet.image)); %> <% const pages = sheets.map((v, i) => i % 2 ? false : sheets.slice(i, i + 2)).filter(Boolean); %>