Reference Fields within Global Fields

You can add a Reference field within a Global field while creating a Global field’s schema. You can then use this Global field in any content type.

Let’s look at an example to understand how developers can use Reference fields within the Global fields.

For instance, you need a website to frequently show author details along with each blog article on every blog post of a popular magazine. Furthermore, you need to make sure that the author information referenced for each blog post stays consistent across every blog written by a particular author.

To achieve this, you can create a child content type named “Author Details” that contains a “Single Line Textbox” field for the author’s name, a “Multi Line Textbox” field for the author’s address, and a “Rich Text Editor” field for the Author’s qualification details. Then create the parent content type, “Blogs”, that contains the header content and footer content.

Now, create a Global field named “Blog Post”. Within this Global field, add the following fields:

  • Single Line Textbox field (for the Blog Title)
  • Rich Text Editor field (for the Blog Content)
  • Reference field (for the Author Details) that refers to the “Author Details” content type

To deploy referenced author details from the child entry consistently across the “Blog” parent content type, simply refer to the “Blog Post” Global field within the parent content type’s entries.

Let us understand how developers can work with Reference fields within Global fields.

Add the Reference Field to Global Fields

To add a Reference field to the Global field, a developer can perform the following steps:

  1. After opening your stack, go to Content > Global Fields.
  2. Click on the + New Global Field button to create a new Global field. Provide a suitable Name and Description to your Global field.
  3. Click on Create and Add fields.
  4. Click on the Reference field option and drag and drop the field from the Fields list displayed at the left-hand side.
  5. From the Referenced Content Type dropdown menu on the right-hand side, select the content type of which entries you need to refer to. Provide a suitable name to the referenced content type (for e.g. Author Details).
    Reference_field_within_Global_Field_on_Global_Field_Builder_Page.png

    Additional Resource: Learn more about the difference between Single and Multiple Content Type Referencing.

  6. Once done with adding the Reference field within the Global field, click on either Save or Save and Close.

Note: You can add only those Reference fields that refer to multiple content types to your Global fields.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

top-arrow