Skip to content

Suggested improvement for /modifiers/shuffle #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AtmoFX opened this issue Apr 21, 2025 · 0 comments
Open

Suggested improvement for /modifiers/shuffle #1668

AtmoFX opened this issue Apr 21, 2025 · 0 comments

Comments

@AtmoFX
Copy link

AtmoFX commented Apr 21, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant