Modifier: flip

Swaps the keys with their corresponding values. The old switcharoo.

  chicken: nuggets
  nuggets: Denver
{{ favorites }}
  My favorite {{ key }} is {{ value }}.
{{ /favoites }}

{{ favorites | flip }}
  My favorite {{ key }} is {{ value }}.
{{ /favoites }}
My favorite chicken is nuggets.
My favorite nuggets is Denver

My favorite nuggets is chicken
My favorite Denver is nuggets.

It’s a weird example with bad grammer. Hopefully you’re okay with it.

Additional Reading

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

Last modified on March 31, 2016