Skip to content

Suggested improvement for /modifiers/shuffle #1668

@AtmoFX

Description

@AtmoFX

From a recent discussion I had with Duncan: statamic/cms#11719 (comment)

I believe the documentation could use a small example of how to shuffle a collection's entries (though it could be an exact equivalent of sort="random"; I do not know if one is faster than the other).

  • The Antlers syntax uses a self-iterating assignment (if there is a better option, make sure to use it instead):

    {{ randomly_sorted_pages = { collection:pages } | shuffle }}
        {{# Do your thing here #}}
    {{ /randomly_sorted_pages }}
    
  • As for the Blade syntax, since I do not use Blade, I can't say.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions