Multiple default sorting when using list combine

Hey Team, I received a custom script as a solution to default sort a number of combined lists. That solved solution is here: Default sort when using list combine

I now need to sort first by items marked as featured.

@jesse.muiruri suggested I try the following:

This isn’t working for me. Do we need to define a hidden field for “featured”? I can’t see the featured toggle in the selector for fs-list-value

Sandbox - Webflow - Ambient AI - New UI

Staging URL - https://ambient-new-ui.webflow.io/resources

Hey @hello6! Good instinct — you’re right that a hidden field is needed. There are actually two things to fix here, so let me walk through both.

The featured field isn’t exposed in the DOM

Looking at your HTML, your items have hidden divs for date and topic, but nothing for featured. The sorting script can’t reference a field that doesn’t exist in the DOM. Since featured is a CMS switch/toggle field, you’ll need a Code Embed element inside each Collection Item (not a regular text block).

Here’s what to add inside the .hub_item element in each of your combined collection lists:

<div fs-list-field="featured" style="display:none;">YOUR-FEATURED-CMS-FIELD</div>

To do this in Webflow:

  1. Inside each Collection Item template, add a Code Embed element
  2. Add fs-list-field=“featured” as a custom attribute on the Code Embed
  3. Inside the embed, use the + Add field button to insert your “Show as featured item” toggle as a dynamic field
  4. Save and close — you can leave it unstyled, the display:none style won’t affect the sort

Do this for all your combined collection lists (Blogs, Webinars, Glossaries, Guides, Whitepapers, Videos) since they all need the field to be present for the combine to work correctly.

The sorting API syntax differs from the documented pattern

The fields array syntax in the suggested script doesn’t match what’s shown in the official v2 API documentation. The documented pattern uses direct property assignment:

listInstance.sorting.value.fieldKey = 'featured';
listInstance.sorting.value.direction = 'desc';

Here’s a working version for sorting by featured first:

<script>
  window.FinsweetAttributes ||= [];
  window.FinsweetAttributes.push([
    'list',
    (listInstances) => {
      console.log('List Successfully loaded!');
      const [listInstance] = listInstances;
      listInstance.addHook('afterRender', () => {
        listInstance.sorting.value.fieldKey = 'featured';
        listInstance.sorting.value.direction = 'desc';
      });
    },
  ]);
</script>

On the “featured first, then by date” goal

I want to be transparent here — multi-field priority sorting (featured descending and then date descending as a secondary sort) isn’t documented in the v2 API. The documented API handles one sort field at a time. We’re flagging this with the team to confirm whether multi-field sorting is supported and if so, what the correct syntax looks like.

In the meantime, start with the two fixes above (DOM field + script syntax) and test that featured sorting works on its own first. That’ll at least confirm the field is wired up correctly. Then we can layer in the date secondary sort once we confirm the best approach. :flexed_biceps:

Hey @Support-Finn, that seems to be working - Resource Hub | Ambient.ai

Let me know once you confirm with the team that multi-sorting is supported and the syntax is correct and we can mark as a resolved solution.