A multi-reference field lets you associate one item with multiple items from another Collection, which is great for tagging and categorization.
Note: We’re transitioning to Workspaces, and this lesson has been updated to reflect that change. Visit the Workspaces blog post to read more about these updates and changes.
A multi-reference field is similar to a reference field, except it allows you to reference more than one item from another Collection and then present these items in a Collection list on a Collection page. This is great for tagging systems and instances where you want to connect one item to many others.
Some common uses for a multi-reference field include:
In this lesson, you’ll learn:
The beauty of the reference and multi-reference fields is that whenever you edit an item that’s being referenced, the new content will automatically update everywhere it’s referenced. For example, if you update a blog post's name, every reference to that blog post will also update automatically.
To add a multi-reference field to a Collection:
If you don’t have a Collection yet, learn how to add a Collection to your site.
Once you've added a multi-reference field to a Collection’s settings, you can go into your Collection items and start adding the referenced items. You can choose to reference multiple Collection items from the Collection you chose in the multi-reference field settings.
To use multi-reference fields in your site pages:
Now, you can add elements and styles to the Collection list and connect those to the multi-reference field. This lets you dynamically pull information from Collection items that are referenced by the multi-reference field.
In this example, we have a “Recipes” Collection with a multi-reference field that’s referencing a "Tags" Collection. We added a Collection list onto the “Recipes” Collection page and connected it to the "Tags" multi-reference field.
Important: Make sure you connect the Collection list to the multi-reference field and not the actual Collection that is referenced. If you connect to the actual Collection, it will pull all the Collection items in that Collection instead of only the referenced ones.
When we add an element (e.g., a Heading, Paragraph, Image, etc.) to this Collection list, we can pull the content for that element from any of the referenced Collection’s fields. For example, you can connect a tag’s name to a Heading element or connect a tag’s icon in an image element.
Let's say you have a “Recipes” Collection that has a multi-reference field connected to a "Tags" Collection. You can use the "Tags" multi-reference field to filter Collection lists that are connected to the "Tags" Collection on both the "Recipes" and "Tags" Collection pages.
For example, you can show all "Recipes" that reference a tag on the "Tags" Collection page (e.g., showing all recipes that reference a “sandwich” tag). To do this:
Let's say, on the "Recipes" Collection page, you want to display a list of all related recipes that have any of the same tags as the recipe you’re currently viewing. To do this:
You can set conditional visibility — using the multi-reference field — to show or hide individual elements in a Collection list or on a Collection page.
This type of condition can only be created in two places:
For example, if you have a Collection called “Recipes” that has a multi-reference field linked to a Collection called “Tags”, you can add conditions based on the reference field “Tags” in any Collection list that is connected to the “Recipes” Collection as well as on the “Recipes” Collection page.
You can add the following conditions based on the multi-reference field:
Let’s say we want to add an “Author” section under each recipe on the “Recipe” Collection page. We can do that by adding a Collection list and connecting it to an “Author” multi-reference field.
Now, what if we want this section to appear only when there are authors set in the multi-reference field? We need to set a condition on the section like this:
You have a limited number of reference fields per Collection depending on your Site plan. Starter, CMS, and Ecommerce Standard Site plans can have up to 5 reference fields per Collection. Business, Ecommerce Plus, Ecommerce Advanced, and Enterprise Site plans can have up to 10 reference fields per Collection. Basic Site plans do not offer reference fields. Learn more about site plans.
There’s no filtering and sorting options for Collection lists because they automatically show the referenced items for that page in the order that you've selected them within the multi-reference field (in the Collection item settings).