Skip to content

Tags ​

Last updated View as Markdown
  • A for loop renders its else block when it has no items, also after an offset that skips all items and for a range such as (3..1). See for.
  • cycle values can contain a colon, for example {% cycle '10:00', '14:00' %}. See cycle.
  • if and unless compare strings that contain and or or, for example {% if title == 'art and design' %}.

Filters ​

  • sum adds the numbers in an array, or the values of one property. See sum.
  • default without an argument returns an empty string for nil, false and empty strings. See default.
  • json prints the JSON of a value directly. Numbers, booleans and nil print without quotes, so the output works inside a <script> tag. See json.

Last updated: