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 ITEMS
Link 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 displayName
for a content item and its items.
PATH
The PATH
link 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 displayName
for a content item and the display names of its containers.
ASSETS
The ASSETS
link 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 displayName
and type
for 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 _link
and 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.
Updated 19 days ago