random Modifier

Overview

Randomizes an array or collection.

Example

Let's say you wanted to fetch a random item from an array. You could randomize the array and then apply a limit: 1 and voila.

The YAML

arr:
- Soda
- Pop
- Coke

The Template

{{ arr | random | limit(1) }}

The Output

Soda (maybe)
Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →