Selecting First first child in page collection

Howdy,

I am working on a blog currently and would like to style a featured post (which will be the most recent) differently than the previous posts on the page. I have been toying around with how to select the first child with an if statement and then moves into a for loop over the other children posts. I have the for loop working perfectly, but I can’t get it to select the first child, it just ignores it.

You have a couple of options… you could use the CSS selector :first-child to select the first ‘blog post’ in a collection. Or you could add a class, or use a different template even to render the first blog post by:

  1. Looping over all the posts
  2. In the loop check the loop.first twig variable and see if it is true. if so, do something different. - http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable