1
2
3
4

The Problem:

On a CMS with many items, We want to specify the order of the first 4 items. However, with Webflow's native sorting, we have to fill in the Sort order for all items because items with an empty Sort order are detected as lower than 1, so they will be shown first, followed by 1, 2, 3, and 4. This script will change that.

How to Use the Script:

  1. Copy the script and paste it just before the closing </body> tag. <script async src="https://cdn.jsdelivr.net/gh/jeminids/webflow-codes@sorting-cms_v1.3/sorting-cms.min.js"></script>
  2. Create a Sort field on the CMS and fill it with the desired values. The lowest value will be shown first.
  3. There are only one attribute to add, data-sort={{ sort }}. Add it to the Collection Item of the CMS and connect it to the Sort CMS we just created.
  4. It's done 🎉