Interface SiteRootSelectionStrategy
-
@ConsumerType public 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 allPage
s 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
theLanguageAlternativesService
cannot return any language alternatives.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable Page
getSiteRoot(@NotNull Page page)
int
getStructuralDepth(@NotNull Page page)
Returns the depth of the content structure managed under the site root.
-
-
-
Method Detail
-
getStructuralDepth
int getStructuralDepth(@NotNull @NotNull Page page)
Returns the depth of the content structure managed under the site root.This defines the number of levels the
LanguageAlternativesService
traverses to collect language roots.Examples:
- With
/content/site
as site root and/content/site/en
as language root the structural depth is1
- With
/content/site
as site root, an intermediate level and a language root at/content/site/us/en
, the structural depth is2
- With
/content/site
as site root, multiple intermediate levels and a language root at/content/site/emea/europe/germany/de
the structural depth is4
- Parameters:
page
- aPage
within a site- Returns:
- an
int
greater or equal to one
- With
-
-