shuffle(userOptions?: Options)
A Lume plugin to register the filter "shuffle" that shuffles an array.
This plugin adds a new filter named "shuffle" (by default) that can be used in your Lume templates to randomly reorder elements in an array.
// In your Lume _config.ts:
import lume from "lume/mod.ts";
import { shuffle, cssBanner } from "hibana/mod.ts";
// In your Lume _config.ts: import lume from "lume/mod.ts"; import { shuffle, cssBanner } from "hibana/mod.ts";
site.use(shuffle());
export default site;
// In your Vento templates: {{ [1, 2, 3, 4, 5] | shuffle }} // This will output a randomly shuffled array, e.g., [3, 1, 5, 2, 4].
{{ for testimonial of testimonials.list |> shuffle }} // Use when building a list of testimonials in a for loop, shuffling their order.