Jade template engine - Each Iteration Offset

express, foreach, node.js, pug, template-engine

Solution

each item, i in list
  li= item
  if i === 1
    | : First item in list!

Problem

Is there a way to offset the 'each' iteration when using the Jade template engine? for example, when passing in the object named list: ``` ul each item in list li #{item} ``` Will output ``` <ul> <li> Item 1 </li> <li> item 2 </li> <li> item 3..... ... </ul> ``` But I want the first item to be displayed differently than the rest of the items, like so: ``` <ul> <li> Item 1: First Item in list! </li> <li> item 2 </li> <li> item 3..... ... </ul> ``` So does anyone know a way to offset the 'each' statement in Jade so that I can render the first item separately and then render each following item starting at the 2nd index?

Original source