CMS & Lists
CMS List Nest
Nest more than 100 items and more than 10 nested lists on a page: the multi-reference workaround for Webflow.
Add the script
<!-- FlowPowerUser · CMS List Nest -->
<script defer src="https://cdn.jsdelivr.net/npm/@flowpoweruser/attributes@1/list-nest.js"></script>Once per project is enough, even if you use the solution on several pages: Project Settings → Custom Code → Head Code.
The script loads alongside the page without holding up rendering; it runs once the page is in place and does nothing while no fpu attribute is there.
Choose the setup
The items reach the slot in one of two ways.
Both can be mixed on one page, each slot uses one.
Example
Page with the parent list
└─ Collection Item
├─ Link Block fpu-nest-element="link" (Current …)
└─ Div Slot fpu-nest-element="target"
fpu-nest-collection="name"
Template page of the parent item
└─ Collection List Wrapper fpu-nest-element="source"
fpu-nest-collection="name"Example
Page with the parent list
├─ Collection Item
│ └─ Div Slot fpu-nest-element="target"
│ fpu-nest-refs="slug-a,slug-b"
│ fpu-nest-collection="name"
└─ Collection List (hidden) fpu-nest-element="source"
└─ Collection Item fpu-nest-slug="slug-a"On the page with the parent list: every parent item gets a link to its template page and a slot that receives the copies.
Points to the parent item's template page.
Place a link block, text link or button in the collection item and set it to “Current …” in Link Settings, i.e. the page of this item. It may be hidden.
The div block inside the parent item that receives the nested items.
Give the div block these attributes, but no fpu-nest-refs: that is how List Nest recognises the template page setup. collection names the source list on the template page.
Stays in place when there are no matches, otherwise it is removed.
Place an element inside the target slot that shows when the list on the template page is empty. When there are matches, the script removes it automatically.
On the collection template page of the parent collection: add a collection list whose source is the parent item's multi-reference field.
The collection list wrapper the items are copied from.
Put the attributes on the collection list wrapper, not on the inner collection list. Style the items the way they should appear in the slot. Their order is the output order.
Tip More than 100 items: on the template page, use the collection itself as the source, filter it by a reference field to the current item and turn on pagination. List Nest loads every following page, up to 50.
On the page where the nested list should appear, define the slot that receives the copies.
The div block inside the target item that receives the nested items.
Select a div block inside the target item and give it these attributes. target marks the slot, refs lists the slugs to nest (comma-separated, order = render order), and collection names the source collection. collection is optional if only one source exists on the page.
Tip Bind fpu-nest-refs to a CMS field (plain text holding the multi-reference slugs) so each item carries its own references.
Stays in place when there are no matches, otherwise it is removed.
Place an element inside the target slot that shows when no referenced items are found. When there are matches, the script removes it automatically.
Place the source list anywhere on the same page, usually hidden.
Its items are cloned into the slots.
The collection list items are cloned from.
Select the collection list of the source collection and give it these attributes. After processing, the list is hidden automatically (display:none).
Important The collection value on the source list and the target slot must match exactly, otherwise the script won't find the source.
Each item of the source list carries its slug.
Give the collection item the slug it is referenced by in fpu-nest-refs, then bind it to the slug field via CMS.
Publish and check on the live site
Attributes solutions do not run in Designer, Edit or Preview mode.
Publish your project and test the result on the published site, after every change.
Optional
More settings
Maximum number of inserted items per slot.
Add this attribute on the target slot to cap the number of inserted items.
Prevents the source list from being hidden automatically.
By default the source list is hidden after processing. With this attribute it stays visible, which helps while building.
Writes one init line to the console.
Logs one line to the browser console on init, which helps while debugging.
Sets defaults for all slots via script.
Define global defaults in a <script> after the include. An attribute on the element always wins over the global value. Example: window.fpuListNestConfig = { limit: 6, logging: false, hideSource: true }
The principle · Why List Nest
CMS List Nest copies items into slots inside your parent item, from its template page or from a source list on the same page. As many lists as you like, up to five levels deep. Entirely through fpu-nest attributes.
- SourceTemplate page or source list, supplies the items.
- SlotDiv block in the parent item, receives the copies.
- OrderAs in the source, or as in refs for the slug setup.
Additional features
- Programmatic APIwindow.fpuListNest exposes instances, init(), refresh() and destroyAll(), e.g. to re-nest after your own CMS loading.
- Eventsfpu:items-changed fires per populated target list (detail: { solution: 'nest', list }). Conversely, List Nest reacts re-render-tolerantly to events from other solutions (Load More, Filter) and refills new slots automatically.
- Multi-level nestingSource items may contain slots themselves; nesting is resolved up to depth 5 (which also guards against circular references).
- Note: interactions & IDsSource items are cloned (cloneNode), since several targets can use the same source. Webflow interactions (IX2) do not survive cloning; id attributes are carried along, so id-based anchors in source items may produce duplicates.