Interface SiteRootSelectionStrategy
Consumers may implement this interface and register the implementation as an OSGI service to provide an algorithm that defines a site
root for a given page.
A site root is the Page that is the common ancestor of all Pages that belong to a single site. In a single-country
setup this is the parent of all language roots. For a multi-country setup it may be different, depending on the content structure.
A default implementation is available called DefaultSiteRootSelectionStrategy. To override it an implementation must be registered
with a service ranking greater then 0. Implementations may fall back to the DefaultSiteRootSelectionStrategy. If they are not able to
return a site root for a given Page the LanguageAlternativesService cannot return any language alternatives.
-
Method Summary
Modifier and TypeMethodDescription@Nullable PagegetSiteRoot(@NotNull Page page) intgetStructuralDepth(@NotNull Page page) Returns the depth of the content structure managed under the site root.
-
Method Details
-
getSiteRoot
-
getStructuralDepth
Returns the depth of the content structure managed under the site root.This defines the number of levels the
LanguageAlternativesServicetraverses to collect language roots.Examples:
- With
/content/siteas site root and/content/site/enas language root the structural depth is1 - With
/content/siteas site root, an intermediate level and a language root at/content/site/us/en, the structural depth is2 - With
/content/siteas site root, multiple intermediate levels and a language root at/content/site/emea/europe/germany/dethe structural depth is4
- Parameters:
page- aPagewithin a site- Returns:
- an
intgreater or equal to one
- With
-