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.

using-references

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:

  1. Log in to the Contentful web app.

  2. In the top pane, click Content model. The “Content model” page with the list of your existing content types is displayed.

  3. Either create a new content type or go to the existing one. The content type editor page is displayed.

  4. Click + Add field.

  5. In the "Add new field" window, select the Reference field type.

  6. In the Name field, enter the name for your field. NOTE: Field ID is generated automatically based on the field name.

  7. Select the type of your reference and the source of the referenced content.

  8. Click Add and configure to continue adding custom settings to your field.

  9. Click Confirm to apply custom settings to your field.

  10. 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:

  1. Log in to the Contentful web app.

  2. In the top pane, click Content. The “Content” page with the list of your existing entries is displayed.

  3. Click Add Entry and select the required content type option from the drop-down. The entry editor page is displayed.

  4. 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:

Was this helpful?
add-circle arrow-right remove style-two-pin-marker subtract-circle remove