The “Reference” field, the “Select” field, and the default “Tags” field of a content type serve different purposes. However, since they have something in common (i.e., selecting among the given options or categorizing entries), it may be a confusing and challenging decision on which field to use for your use case.
Let’s have a look at the characteristics of these three fields and their usage recommendations.
- Reference fields are commonly used to add references to other entries.
- On the entry page, the reference field is like a dropdown list that shows all entries of the referred content type(s) as available options.
- When an option is selected, a reference to that entry is stored in the backend.
- Examples of usage:
- “Category” field within Blog content type
- “Author” field within Blog content type
- “Store Location” field within Product content type
- For navigation of a site
- Using a reference field helps in:
- Avoiding rework in case of changes: If there is any change in the referred entry, it automatically gets reflected in all the entries where it was referred. For example, if the author changes her profile image, it would reflect in all the entries where the author’s entry was referred to.
- Avoiding manual work of adding data repeatedly: Instead of repeatedly adding author details on each blog post, select the relevant author entry from the list.
- Avoiding manual work when the selected list of values change: When the set of predefined choices constantly changes, use a Reference field instead of a Select field. For example, Suppose a store manager constantly updates a list of store locations with newly added stores. In that case a Reference field helps to select the store location from the referred entry list.
- The Select field allows choosing from two or more predefined choices.
- On the entry page, the options of the Select field can be displayed as either dropdown or radio buttons.
- When an option is selected, it stores the actual value of the selected option in the backend.
- It is recommended to use when the choices are predefined and are not likely to change.
- Examples of usage:
- “Gender” field in a survey form
- “Age Group” field in a form
- Commonly used to add tags to an entry.
- The applied tags are visible on the entry list page.
- Use tags if you plan to search entries by tags using Contentstack’s Advanced Search.
- Not recommended if you wish to retrieve entries (by filtering) using APIs.
- To categorize similar entries for easy retrieval later using API queries, we suggest using the Reference field (marked as multiple) instead of Tags.
- Use Reference fields for fields such as Categories, Author, Navigation.
- Use the Select field when the options are predefined and are not likely to change. Any changes require a developer to update the content type constantly.
- Avoid Tags unless you want to search entries by tags using Contentstack’s Advanced Search.
Additional Resource: If you want to learn more about fields, refer to our documentation on Field Properties.