References
Overview
A reference is a relationship between entries that allows you to link one entry to another. This relationship is set up through a reference field in a content type.
References allow you to reuse content instead of recreating it multiple times. For example, you need to write a bio to add to multiple blog posts. Instead of copying and pasting it to each individual blog post, you can create a dedicated "Bio" entry and link this entry in your blog posts through a reference field.
With references, you can reuse content throughout the various channels of your company. Also, any edits you make to a referenced entry propagate to all the entries in which it is reused. For example, if you update the copyright year on your legal notice, you don’t have to go back to each page and change it manually. Once you publish the updated referenced entry, your changes are live everywhere you link to that entry.
For Premium plan customers, you can use the Cross-space references feature to create reusable content and update multiple spaces and environments with the same piece of content.
Nested entries
A nested entry, also referred to as referenced entry, is an entry that is referenced in another entry, i.e. linked to it through the reference field.
Types of references
There are the following types of references in Contentful:
By a relationship type:
One-to-one — Allows you to link a single entry through a reference field.
One-to-many — Allows you to link multiple entries in the same reference field.
By source:
Same space — Allows you to link entries only within the same spaces.
Different spaces — Allows you to link entries from other spaces.
Set up a reference field
To set up a reference field:
Log in to the Contentful web app.
In the top pane, click Content model. The “Content model” page with the list of your existing content types is displayed.
Either create a new content type or go to the existing one. The content type editor page is displayed.
Click + Add field.
In the "Add new field" window, select the Reference field type.
In the Name field, enter the name for your field.
NOTE: Field ID is generated automatically based on the field name.Select the type of your reference and the source of the referenced content.
Click Add and configure to continue adding custom settings to your field.
Click Confirm to apply custom settings to your field.
After the field is added, click Save to apply changes to the content type.
Add references to an entry
To add references to an entry:
Log in to the Contentful web app.
In the top pane, click Content. The “Content” page with the list of your existing entries is displayed.
Click Add Entry and select the required content type option from the drop-down. The entry editor page is displayed.
In the entry editor, click + Add content and select one of the following options:
Add existing content — Click on this button to open the "Add existing entry" window and select the desired entry from the list
New content — Select the required content type option to create a new entry.
Additional resources
To learn more about how to set up and use one-to-one and one-to-many references through an example of a landing page, watch the following video: