Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideRecipesAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Content links

Describes the links available for querying CMS (SaaS) content in Optimizely Graph.

Links in Optimizely Graph are a way to define relations between indexed items, see Joins with linking in Optimizely Graph documentation. Some links are available when querying Content Management System (CMS) (SaaS) content from Optimizely Graph.

ITEMS

The ITEMSLink type is the default if no type is specified. It returns all content items that are contained within the current item, similar to child items in a tree structure.

query ItemsQuery {
  _Content {
    items {
      _metadata {
        displayName
      }
      _link {
        _Content {
          items {
            _metadata {
              displayName
            }
          }
        }
      }
    }
  }
}

Example: Query the displayNamefor a content item and its items.

PATH

The PATHlink type returns the containers for a content item, potentially across several levels, similar to ancestor nodes in a tree.

query PathQuery {
  _Content(where: { _metadata: { displayName: { eq: "Whitepaper" } } }) {
    items {
      _metadata {
        displayName
        locale
      }
      _link(type: PATH) {
        _Content(where: { _metadata: { locale: { eq: "en" } } }) {
          items {
            _metadata {
              displayName
            }
          }
        }
      }
    }
  }
}

Example: Query the displayNamefor a content item and the display names of its containers.

ASSETS

The ASSETSlink type returns exclusive assets associated with a content item. These assets display in CMS (SaaS) UI in the For This Page, For This Block, or For This Content folders.

query AssetsQuery {
  _Content(where: { _metadata: { displayName: { eq: "Start" } } }) {
    items {
      _metadata {
        displayName
      }
      _link(type: ASSETS) {
        _Content {
          items {
            _metadata {
              displayName
              type
            }
          }
        }
      }
    }
  }
}

Example: Query the displayNameand typefor assets linked to a content item.

Querying linked blocks in a folder

In some cases, content items are linked through _link, which lets you traverse relationships not covered by the default items, path, or assets link types. The following query retrieves all blocks located in a specific folder by using _linkand specifying a component link target.

query MyQuery {
  _Folder(
    where: { _metadata: { key: { eq: "<folder guid>" } } }
  ) {
    item {
      _link {
        _Component {
          items {
            _metadata {
              key
              displayName
            }
          }
        }
      }
    }
  }
}

This query is not recursive—it only returns the blocks directly inside the specified folder, not those in subfolders.

Example: Query the key and displayName for blocks in a folder by its GUID.

This approach is especially useful when you want to avoid placing a large number of blocks into a ContentArea. It lets you structure folder-based querying without overloading a single container.