Headless Server Developer Manual / Version 2512.1
Table Of ContentsLocalized variants of any content object can be obtained using either the field localizedVariants or localizedVariant. The first will return all existing variants of a content object while the latter requires specific locale parameters in order to retrieve the variant of a specific variant.
Note
On a live server, both fields only return variants that are reachable through published master content items. Variants are located by following the master relation up to the topmost master. As master is a weak link, a master may remain unpublished while the content item linking to it is published. The relation can then not be resolved, and the traversal stops. A common case is an abstract site, which is never published, so the sites directly derived from it do not list each other's content items as localized variants. See Section “Abstract Sites” in Multi-Site Manual for the background.
query LocalizedVariants($path: String!) {
content {
pageByPath(path: $path) {
title
type
localizedVariants {
... on CMChannel {
repositoryPath
locale
}
}
localizedVariant(language: "en", country: "us", variant: "") {
... on CMChannel {
repositoryPath
locale
}
}
}
}
}With the locale specific approach, the parameter language is mandatory, while country and variant are optional. Please note, that if a given combination of locale parameters does not exist you may get an empty object. When skipping the parameter country however, the first variant matching the language will be returned.


