Global Fields within Group Fields

You can add a “Global” field within a “Group” field while creating a content type. This means that developers can organize and reuse a set of simple fields across several content types.

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

For instance, you want to provide SEO executives with the freedom to reuse SEO data across several web pages of their site. This SEO data will eventually form a smaller part of certain meta information for the web pages.

To achieve this, you can create a Global field named “SEO Standard”. Within this Global field, add a Single Line Textbox field (for the SEO Title) and a Rich Text Editor field (for the Meta Description). Once done with creation of the Global field, you can create content types for each web page of your site. In each content type, add a Group field named “SEO Content”. Then, within the Group field, add a Single Line Textbox field (for the Title) and a Multi Line Textbox field for the Meta Information. Now, to display your standard SEO content, you can simply add the “SEO Standard” to your Group field.

The set of subfields present in the Global field automatically load onto your content type.

Let us see how developers can work with Global fields inside Group fields.

Add the Global Field to Group Fields

To add a Global field to the Group field, log in to your Contentstack account, go to your stack, and perform the following steps:

  1. Click the “Content Models” icon on the left navigation panel and select Content Types.
  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 Proceed.
  4. Click on the “Insert a field link” and select the Group field option from the Fields list that appears as a floating menu. Provide a suitable name for your Group field (for e.g. Banner).
  5. Now, from the “Insert a field” icon, add fields of your choice into this Group field (for e.g. a Single Line Textbox field for the banner title or a Rich Text Editor field for the banner description).
  6. Once done with adding fields within the Global field, click on either Save or Save and Close.
  7. Now, go to the Content Type Builder page of any content type, select the Global field from the “Insert a field” icon
  8. Select the Global field you just created (for e.g. Advertisements and More) from the Select Global Field dropdown menu, which can be accessed by clicking on the “settings” gear icon and selecting the Basic option.


Note: When you add a Group field to your Global field, each Group field counts as a single level of nesting.

You can similarly refer to the same Global field within multiple content types to display your standard SEO content.

Was this article helpful?