Context:
I have a client with many different resource types (blogs, news, case studies, etc.). Each resource type is a collection, but they want to have one information hub with all resource combined and filterable. I have the following attributes set up on the page: CMS Combine, CMS Nest, CMS Filter, CMS Load, CMS Sort. The client want the resources sorted by date(newest-oldest), and they want to select ~3 featured resources “pinned” (sorted) to show at the top of the list.
Issue:
I’m having trouble stacking the sorts, would the “feature” sort field be able to be added to the same trigger button if it is sorting the same combined collection list?
My current setup (not working) is to have a second trigger button, with fs-cmssort-element = “trigger-2” and the combined collection list has the attribute fs-cmssort-element = list, list-2?
Any insight on how to get this working?
I found this on the sort documentation but I’m still a bit confused: “If more than one trigger belongs to the same list (currently only supported with Button Triggers), all the triggers must match the list instance number.”
hey @Poetic! the -x suffixes are used when we have more than one list to be sorted/filtered/loaded. If you only have one list all your elements should not have any suffixes as they belong to the same fs-cmssort-element = list.
For multiple sort triggers, what will differentiate them is the IDENTIFIER you use to link the fields to be sorted. Let me know if this makes sense
This makes sense, I adjusted my setup accordingly. However, even though this is set up correctly according to automated support, neither sort is working. Any ideas on how to get this functional?
Hey @Poetic! I see you are using fs-cmssort-field="IDENTIFIER" on your date fields. I do suggest you use another identifier such as date or published.
Also, when combining CMS Nest and CMS Combine you’ll need to prevent the script from running instantly, you can do this by using this script for CMS Combine
You are also missing the fs-cmssort-type = date on your trigger button.
For the featured field we will need to think of another way as all items have the same content in the Featured element inside the blog card and the sorting does not affect them. Can you add the featured field as an embed like on the image attached? Once you have the date sort working correctly we can jump on this other field
@Poetic I am afraid we will not be able to use the same button to trigger both sort fields. Nor a combination of two sorting fields. So a compromise on which field should the list be sorted by must be made. If you go with the date field, removing the featured identifier from the trigger will do the trick.
If you go with the featured field you’ll need to remove the date from the trigger and move your fs-cmssort-field = featured to only the HTML embed.
I also see that you have the CMS Sort script added twice, one without the prevented load and one with the setting applied. I also made a typo on the class name for the sort button it should be .fs_cmssort_button my bad.
CMS Sort can have several sort fields per list but there is no current what of sorting by two fields at the same time. The list will be filters by “featured” or by “date” but it does not stack the sorts as “Sort by featured then by date”
The duplicated script is in your page settings, you can remove the top one as it is missing the fs-attributes-preventload = "true" setting