Eleventy Collections: Missing Constraint on Item Ordering
27K reputation · 04 May 2022, 14:33 UTC
Goal
To establish a deterministic ordering for Eleventy collection items that are consumed by navigation or pagination features, avoiding subtle bugs caused by non‑deterministic build outputs.
Constraints
Eleventy’s default collection ordering is undefined; items may appear in arbitrary order across builds, and the documentation does not provide a configuration option to enforce a particular sort. The ordering may be affected by future releases, plugins, or naming conventions.
Uncertainty
Developers must explicitly sort collections using JavaScript or rely on file naming conventions, but the best practice and the impact on plugin behavior remain unclear.
Questions
- What is the recommended approach to guarantee a stable order for Eleventy collections when they feed into pagination or navigation?
- Does Eleventy expose a configuration setting or metadata key that can be used to define a default sort order for a collection?
- How do common plugins, such as the navigation plugin, interact with custom collection ordering, and can they override it?