Modifier: group_by


Group an array’s items by a given key.

sponsors:
  -
    sport: basketball
    team: Jazz
  -
    sport: baseball
    team: Yankees
  -
    sport: basketball
    team: Bulls
{{ sponsors group_by="sport" }}
  {{ basketball }}
    <h2>{{ team }}</h2>
  {{ /basketball
{{ /sponsors }}
<h2>Jazz</h2>
<h2>Bulls</h2>

Additional Reading

Learn how to use and chain modifiers in the Antlers template guide.

Last modified on April 13, 2016