cs-icon.svg

Global Field Use Cases

A Global field is a reusable set of fields that you define once and use in any content type across your stack. It helps streamline your content modeling by eliminating the need to recreate the same field configuration multiple times.

You can modify key properties of a Global field at any time based on your requirements. These properties include Select Global Field, Display Name, Unique ID, Instruction Value, Help Text, Multiple, and Non-localizable.

Let’s explore real-world use cases to understand how you can effectively implement Global Fields in your content types.

Example 1: SEO as a Global Field

Adding an SEO Global field to your content types helps enhance search engine visibility and attract more traffic to your site. Developers can define an SEO schema once and reuse it wherever needed.

  1. Log in to your Contentstack account and open the Content Models module.
  2. Go to the Global Fields tab and click + New Global Field.
  3. Add the following fields:
    • Single Line Textbox: Title tag for your page.
    • Multi Line Textbox: Meta description summarizing the page content.
    • Single Line Textbox: Keywords to optimize SEO.
    • Boolean: Option to enable/disable search engine crawling.
    • Boolean: Option to include/exclude content from internal search.
  4. Save the Global field.
  5. Go to the content type where you want to add SEO, insert the Global field, and select your SEO configuration.
  6. Set a display name and modify other properties as needed.
  7. Create an entry to see the SEO Global field in action. SEO Global field in entry view

Example 2: Site Header as a Global Field

Use a Site Header Global field to maintain consistency across website pages. The header may include a logo, navigation menu, and notification bar.

  1. Create a Global field named Header.
  2. Add the following fields:
    • File: Upload your logo.
    • Group (Navigation Menu):
      • Single Line Textbox: Title of the navigation item.
      • Reference Field: Links to other content types or pages.
    • Group (Notification Bar):
      • Rich Text Editor: Add announcement content.
      • Boolean: Toggle visibility of the notification bar.
  3. Save the Global field.
  4. In your target content type, insert the Header Global Field, set a display name, and configure other properties.
  5. Create an entry to see the Header field in use. Header Global field example in entry

Example 3: Taxonomy Group Field as a Global Field

Organize content with a Taxonomy Global field to enhance navigation and user experience.

Example: Displaying sports categories on a sports website.

  1. Create a Global field named Sports Categories.
  2. Add a Modular Blocks field.
  3. Inside the block, add a Group field and enable Multiple selection.
  4. In each group, add:
  5. Save and insert this Global field into the relevant content types.
  6. Configure the display name and other properties.
  7. Create an entry to implement content categorization using taxonomy. Taxonomy Global field used for category

Example 4: Website Banner as a Global Field

Use a Global field for your website’s banner section, which typically appears on multiple pages.

  1. Create a Global field named Hero Banner.
  2. Add a Modular Blocks field and name it (e.g., Page Components).
  3. In the Hero Banner block, add the following fields:
    • File: Upload a banner image.
    • Custom: Use the Color Picker Custom Field Extension for background color.
    • Single Line Textbox: Banner title.
    • Multi-Line Textbox: Banner description.
  4. Save the Global field.
  5. Add it to any content type where the banner appears.
  6. Set the display name and other properties.
  7. Create an entry to render the banner.

Example 5: Open Graph Meta Tags as a Global Field

Open Graph tags control how your content appears when shared on social media.

  1. Create a Global field named Open Graph Meta Tags.
  2. Add the following fields:
    • Single Line Textbox: Type of content.
    • Single Line Textbox: Page title.
    • Single Line Textbox: Page URL.
    • Multi-Line Textbox: Content summary.
    • File: Image preview.
  3. Save the Global field.
  4. Add it to content types as needed.
  5. Configure the display name and other properties.
  6. Create an entry to enable social sharing previews. Open Graph Global Field configuration

Example 6: Twitter Card Tag as a Global Field

Twitter Cards enhance how your content appears when shared on Twitter.

  1. Create a Global field named Twitter Card Tag.
  2. Add the following fields:
    • Single Line Textbox: Type of card (e.g., summary).
    • Single Line Textbox: Twitter handle or username.
    • Single Line Textbox: Title for the card.
    • Multi Line Textbox: Page description.
    • File: Image to display.
  3. Save the Global field.
  4. Add it to your content types and configure properties.
  5. Create an entry to preview the Twitter Card. Twitter Card metadata as Global field

Example 7: Nested Global Fields for Reusable Field Patterns

You can nest a Global field within another field such as a Group or Modular Block. This allows you to create flexible, reusable content structures.

Use Case Example: Page Components with Nested SEO Field

  1. Create a Global field named Page Components.
  2. Add a Modular Blocks field.
  3. In each block, include:
    • A Group field for structural content (title, media, layout).
    • A Nested Global Field for SEO. Nested Global field used in Page Components

This setup allows editors to build modular pages with pre-configured SEO capabilities. By nesting the SEO field, you maintain centralized control while giving editors flexibility to assemble content as needed.

Additional Resource: Learn more about Complex Fields and how they work inside Global fields to maximize reusability and flexibility.

Was this article helpful?
^