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, a developer can perform the following steps:
- After opening your stack, go to Content > Content Types.
- When you hover on the content type that you want to edit, on the extreme right side, you will see the 'More Options' icon (three vertical dots). Click on this icon and select Edit Content Type to open the Content Type Builder page.
- Click on the Group field option or drag and drop the field from the Fields list displayed at the left-hand side.
- Once added, drag and drop the Global field from the Fields list into your Group field.
- From the Select Global Field dropdown, select the Global field that you want to refer to (for e.g., SEO Standard). Provide a name of your choice for this Global field (e.g. SEO Content), and click on Create.
You will notice that all the subfields of the SEO Standard Global field have automatically loaded into your Group field schema.
You can similarly refer to the same Global field within multiple content types to display your standard SEO content.