You’ll have to add the custom code on the clonable page, the date field to your collection items and the corresponding CMS Sort setup for sorting by dates.
Let me know if you need help once you add these to the setup!
This doesn’t seem to be sorting correctly. I cloned your example, gave it a date field, and it persists in sorting alphabetically (April, February, October, etc).
I had the same problem on my site: 2 CMS collections combined; sorting by name did work – sorting by “updated” (date) did not work. Turned out, that the date-format “D/M/YYYY” was the problem.
Changed to “M/D/YYYY” (in a hidden field) solved the problem. Even with using weglot.
Hello! I am trying to acheive a similar solution here. I’m trying to combine three lists – “News”, “PDFs” and “Posts”. I have acheived success with the CMS Combine attribute, but am wanting to know the best way to sort them by most recent date to have them appear in a mixed list together.
I don’t have any intention to implement on-page sorting controls like buttons or dropdowns. What’s my best option for sorting here? Do I have to implement CMS Sort and auto-click a hidden button, or is there an easier way to implement this?
Hey @kristen.m.samuelsen! You can achieve this using the new API in Attributes V2. A sorting element is required, but it can be hidden—such as a button with the attribute fs-list-element="sort-trigger".
This is the API callback that will sort the list, simply modify the fieldKey and direction to suit your setup!